You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by wanglingyu <wl...@163.com> on 2022/11/24 07:04:00 UTC

nsh_main cant running and print no output

Hi,


I have a problem about nuttx during moving a new chip with hc32.
the board can output with lowputc, system can run, and gpio control is ok,
but printf in libc can't output anything, and at same time, nsh_main also not running, 
it makes shell not being used. the codes is compiled and linked. 
Please give some advices for the problem. Thanks!!!


Br,
Wang Lingyu

Re: nsh_main cant running and print no output

Posted by Nathan Hartman <ha...@gmail.com>.
On Thu, Nov 24, 2022 at 8:00 AM Alan C. Assis <ac...@gmail.com> wrote:
> Seems like you are mixing the HDSC SDK code with NuttX code, it is
> better to start a clean port to this new chip.


Agreed it is better to do a clean port to this new chip. That will
make it possible to upstream it to NuttX mainline, so that when other
developers make improvements to it, you will benefit from those
improvements too.

To make a clean port, it is best to find a similar arch and use it as a guide...

Cheers,
Nathan

Re: nsh_main cant running and print no output

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Mr. Wang,

Did you modify the driver to support both interrupts?

Also, do you have JTAG (OpenOCD) + GDB support to HDSC HC32 chips?

Using JTAG+GDB will be easier to track the root cause of the issue.

Seems like you are mixing the HDSC SDK code with NuttX code, it is
better to start a clean port to this new chip.

What board are you using? I didn't find a hc32f4a0 board at Aliexpress.

BR,

Alan

On 11/24/22, wanglingyu <wl...@163.com> wrote:
> I attached more detail for the problem.
> hc32f4a0 is similar with stm32f407, but the serial irq is different with
> stm32f407,
> it includes rx and tx and error irq , but stm32f4 includes one irq including
> rx and tx.
> I uses UART6 as the console device and merge the relative register operation
> in hc32 sdk as serial output, the codes as below:
> void arm_lowputc(char ch)
> {
>     while(Set != USART_GetStatus(DBG_UNIT, USART_FLAG_TXE));
>     USART_SendData(DBG_UNIT, ch);
> }
> Using the function, I can observe the output by UART6. and like _info,syslog
> also can print something.
> For porting printf, I calls uart_register to register /dev/console with
> UART6,
> but "printf" can't output anything, any log can't appear. and nsh_main also
> seems not to be running.
> I make a test case in nuttx main under nx_start.
> fd = open(/dev/console, "0x6")
> write(fd, "test", 4)
> it is ok, "test" can print.
> but when I use printf, the system is suspend.
> By tracing the printf, I think the final operation of printf is operating
> /dev/console. so I don't know why
> the problem happend.
>
>
>
> attached .config and map file. thanks!!!
>
>
>
>
>
>
>
>
>
>
> At 2022-11-24 15:04:00, "wanglingyu" <wl...@163.com> wrote:
>
> Hi,
>
>
> I have a problem about nuttx during moving a new chip with hc32.
> the board can output with lowputc, system can run, and gpio control is ok,
> but printf in libc can't output anything, and at same time, nsh_main also
> not running,
> it makes shell not being used. the codes is compiled and linked.
> Please give some advices for the problem. Thanks!!!
>
>
> Br,
> Wang Lingyu

Re:nsh_main cant running and print no output

Posted by wanglingyu <wl...@163.com>.
I attached more detail for the problem.
hc32f4a0 is similar with stm32f407, but the serial irq is different with stm32f407, 
it includes rx and tx and error irq , but stm32f4 includes one irq including rx and tx.
I uses UART6 as the console device and merge the relative register operation 
in hc32 sdk as serial output, the codes as below: 
void arm_lowputc(char ch)
{
    while(Set != USART_GetStatus(DBG_UNIT, USART_FLAG_TXE));
    USART_SendData(DBG_UNIT, ch);
}
Using the function, I can observe the output by UART6. and like _info,syslog also can print something.
For porting printf, I calls uart_register to register /dev/console with UART6,
but "printf" can't output anything, any log can't appear. and nsh_main also seems not to be running.
I make a test case in nuttx main under nx_start.
fd = open(/dev/console, "0x6")
write(fd, "test", 4)
it is ok, "test" can print. 
but when I use printf, the system is suspend.
By tracing the printf, I think the final operation of printf is operating /dev/console. so I don't know why 
the problem happend. 



attached .config and map file. thanks!!!










At 2022-11-24 15:04:00, "wanglingyu" <wl...@163.com> wrote:

Hi,


I have a problem about nuttx during moving a new chip with hc32.
the board can output with lowputc, system can run, and gpio control is ok,
but printf in libc can't output anything, and at same time, nsh_main also not running, 
it makes shell not being used. the codes is compiled and linked. 
Please give some advices for the problem. Thanks!!!


Br,
Wang Lingyu