RISC-V中的串行通信中的堆栈用法和字符串输出限制(使用FreedomStudio)
我正在使用Sifive的FreedomStudio(基于Eclipse IDE)开发在Hifive1 Rev B设备上。
使用串行通信时存在问题。根据主函数中数组的大小,串行通信中的输出受到限制。例如,如果本地变量数组的大小为240 * 4字节,则字符串“ Hello World”通常是输出。但是,在超过256 * 4个字节的情况下,仅输出字符串“ H”的一部分,或者什么也没有输出。根据堆栈使用情况,是否有对串行通信的限制?
附加代码以更好地理解。
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");
}
(添加)
我们确实在字符串正常出现的情况下调试了代码。结果,我们看到该代码被陷阱处理程序扔进了陷阱。根据陷阱的评论,RISC-V的引导加载程序系统存在一些问题。但是,我们使用的Hifive1 Rev B的RAM大小为16KB。
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....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论