You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug was discovered trying to use the fft library in the kendryte-freetos-sdk as it requires exceptions to find a spare dma. The example code consistently calls sys_exit when it's run on the MAIX One Dock.
Expected behavior
C++ exception should be caught by the nearest catch statement.
Actual behavior
Throwing an exception causes a fatal error and halt.
externvoiddo_exception_test();
intmain(void)
{
do_exception_test();
while (1)
;
return0;
}
exception_test.cpp:
#include<stdio.h>voidcatch_test(booldo_throw)
{
if (do_throw) {
printf("throwing exception\n");
throw20;
}
printf("not throwing exception\n");
}
extern"C"voiddo_exception_test()
{
printf("Starting exception test\n");
try {
catch_test(false);
printf("PASS - no exception thrown\n");
}
catch(...) {
printf("ERROR - exception shouldn't be throw\n");
}
boolexception_caught= false;
try {
catch_test(true);
}
catch(...) {
printf("PASS - exception should be throw\n");
exception_caught= true;
}
if (!exception_caught) {
printf("ERROR - exception should have been throw\n");
}
}
Workaround
The problem can be fixed by manually moving crtend.o and crtn.o to the very end of the link command. I'm not sure how to make this the default though, or whether it could also be fixed in the kendryte.ld file.
Background
This bug was discovered trying to use the fft library in the kendryte-freetos-sdk as it requires exceptions to find a spare dma. The example code consistently calls sys_exit when it's run on the MAIX One Dock.
Expected behavior
C++ exception should be caught by the nearest catch statement.
Actual behavior
Throwing an exception causes a fatal error and halt.
Test code
See https://gitlab.com/nemach-embedded/maix-pio-exceptions
main.c:
exception_test.cpp:
Workaround
The problem can be fixed by manually moving crtend.o and crtn.o to the very end of the link command. I'm not sure how to make this the default though, or whether it could also be fixed in the kendryte.ld file.
Automatically generated command producing failing elf:
Modified command producing working elf:
Tool/ Library Versions
CONFIGURATION: https://docs.platformio.org/page/boards/kendryte210/sipeed-maix-one-dock.html
PLATFORM: Kendryte K210 (1.2.2) > Sipeed MAIX ONE DOCK
HARDWARE: K210 400MHz, 6MB RAM, 16MB Flash
Target Hardware
MAIX One Dock
Host System
Windows 10 64-bit
VS Code 1.49.1
The text was updated successfully, but these errors were encountered: