tmedicci opened a new pull request, #16175:
URL: https://github.com/apache/nuttx/pull/16175

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   This PR fixes a bug on the `usbconsole` defconfigs for Espressif's RISC-V 
SoCs when the serial/JTAG is used and the Kconfig macro `DEBUG_FEATURES` is 
enabled. This config enables the `showprogress` macro during start-up. 
Previously, `riscv_lowputc` function was used by this macro, but it is not 
suitable for the serial/JTAG console. Instead, use the `esp_rom_printf` 
function that is suitable for both serial/JTAG and UART consoles.
   
   ## Impact
   
   Impact on user: YES. It enables using usbconsole defconfig to work with 
`DEBUG_FEATURES` selected.
   
   Impact on build: NO.
   
   Impact on hardware: Yes, it affects all Espressif's RISC-V SoCs.
   
   Impact on documentation: NO.
   
   Impact on security: NO.
   
   Impact on compatibility: NO.
   
   ## Testing
   
   One can test the behavior before and after this patch using ESP32-C3, 
ESP32-C6 or ESP32-H2. Just build and flash the device and, then, press the 
reset button. The device will not boot before applying this PR's patch.
   
   ### Building
   
   ```
   make -j distclean && ./tools/configure.sh esp32c6-devkitc:usbconsole && 
kconfig-merge -m .config ../esp-nuttx-ci/configs/build && make olddefconfig && 
make flash EXTRAFLAGS="-Wno-cpp -Werror" ESPTOOL_PORT=/dev/ttyACM0 
ESPTOOL_BINDIR=./ -s -j$(nproc)
   ```
   
   ### Running
   
   Attach the USB cable to the the serial/JTAG's USB port. Then, use `picocom` 
or `minicom` to interact with NSH.
   
   ```
   picocom -b 115200 /dev/ttyACM0
   ```
   
   ### Results
   
   Without this patch, the firmware runs just after flashed:
   ```
   picocom v3.1
   
   port is        : /dev/ttyACM0
   flowcontrol    : none
   baudrate is    : 9600
   parity is      : none
   databits are   : 8
   stopbits are   : 1
   escape is      : C-a
   local echo is  : no
   noinit is      : no
   noreset is     : no
   hangup is      : no
   nolock is      : no
   send_cmd is    : sz -vv
   receive_cmd is : rz -vv -E
   imap is        : 
   omap is        : 
   emap is        : crcrlf,delbs,
   logfile is     : none
   initstring     : none
   exit_after is  : not set
   exit is        : no
   
   Type [C-a] [C-h] to see available commands
   Terminal ready
   pmu_param(dbg): blk_version is less than 3, act dbias not burnt W (162) clk: 
esp_perip_clk_init() has not been implemented yet
   ABC
   NuttShell (NSH) NuttX-10.4.0
   nsh> 
   ```
   
   Pressing the button, as expected, makes `picocom` lose the connection:
   ```
   NuttShell (NSH) NuttX-10.4.0
   nsh> 
   FATAL: read zero bytes from port
   term_exitfunc: reset failed for dev UNKNOWN: Input/output error
   ```
   
   One can check that, after running `picocom` again, the device is halted:
   ```
   $ picocom -b 115200 /dev/ttyACM0
   picocom v3.1
   
   port is        : /dev/ttyACM0
   flowcontrol    : none
   baudrate is    : 115200
   parity is      : none
   databits are   : 8
   stopbits are   : 1
   escape is      : C-a
   local echo is  : no
   noinit is      : no
   noreset is     : no
   hangup is      : no
   nolock is      : no
   send_cmd is    : sz -vv
   receive_cmd is : rz -vv -E
   imap is        : 
   omap is        : 
   emap is        : crcrlf,delbs,
   logfile is     : none
   initstring     : none
   exit_after is  : not set
   exit is        : no
   
   Type [C-a] [C-h] to see available commands
   Terminal ready
   
   
   ```
   
   After this PR's patch, one can press the reset button and run `picocom` 
again without any issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to