Tests hang when compiled for x86 but run fine in simulator for target uC #759
-
I'm trying to get a feel for how to write my code in way that it can be cross compiled (XC16 for pic24) and tested in the simulator, but also natively compiled to run a more expansive tool set on the code like gcvor and eventually things like sonarqube, valgrind, etc. My target platform is a PIC24 and I was delighted to see an example is provided. Actually, I'm using this slightly update fork, which works great when run as designed, using the microchip simulator. I then tried to adapt it so that it would run natively outside of the simulator. I did this mainly by slimming down p24hj128GP202.h file included with the compiler to just the extern'd declerations necessary for the project to compile. Then I added a p24hj128GP202.c to effectively provide RAM based SFR definitions during native compilation, implemented like this:
I then commented out the :tools: section of my project.yml so it would just use the default gcc. This leads to a project that compiles but hangs when attempting to run the unit tests like this:
It's important to note that if I uncomment the tools section so that it complies with XC16 and executes in the microchip simulator, everything works as expected. I would really appreciate if anyone could help me understand where I'm going wrong here. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hook up the gdb to the executable, but from afar that elf suffix is strange (should be .a or .exe). Also it coukd be that you are waiting for some register to flip, but it does not... |
Beta Was this translation helpful? Give feedback.
-
I figured it out, the example i'm using goes into a forever DeadLoop per the cross compilation guidance here once the tests are complete. The text fixture looks like it actually monitors the ouput for the "OK" and then effectively kills the process. Without that logic, the native build just got stuck in the DeadLoop. Changing this:
to this
Resolved my native build issues. Thanks @Letme for the help. |
Beta Was this translation helpful? Give feedback.
-
I am not sure what else that fork does, but such defines could be in |
Beta Was this translation helpful? Give feedback.
I figured it out, the example i'm using goes into a forever DeadLoop per the cross compilation guidance here once the tests are complete. The text fixture looks like it actually monitors the ouput for the "OK" and then effectively kills the process. Without that logic, the native build just got stuck in the DeadLoop. Changing this:
to this
Resolved my native build issues. Thanks @Letme for the help.