1 year ago

#361779

test-img

YoungBeom Kim

Stack usage and string output limit in serial communication in RISC-V (using FreedomStudio)

I am developing using SiFive's FreedomStudio (based eclipse IDE) on HiFive1 Rev B equipment.

There is a problem while using serial communication. Depending on the size of the array in the main function, the output in serial communication is limited. For example, if the size of the local variable array is 240 * 4 bytes, the string "hello world" is normally output. However, in the case of more than 256 * 4 bytes, only a part of the "h" of the string is output, or nothing is output. Are there any restrictions on serial communication depending on stack usage?

A codes are attached for better understanding.

int main()
{
   int a[240] = {0x00,};

   // Case 1 
   // In serial Communication it print whole txt (ex "hello world")
   printf("hello world\n");
} 

int main()
{
   int a[256] = {0x00,};

   // In serial Communication it print some part of txt (ex "h")
   printf("hello world\n");
} 

(add)

We did debug our code for the situation where the string didn't come out normally. As a result, we saw that the code was thrown into Trap.S by the trap handler. According to the comments of Trap.S, there is some problem with the bootloader system of RISC-V; however, the ram size of the HiFive1 Rev B we use is 16KB....

c

serial-port

embedded

riscv

0 Answers

Your Answer

Accepted video resources