Open steph643 opened 2 years ago
Given you are not initializing the struct, is it possible you have an invalid float that is causing a trap when you do your math?
Thanks @cujomalainey .
I added a memset(&s, 0, sizeof(MyStruct));
in setup() but the behavior is the same.
If you don't multiply by 3 does it work?
If you don't multiply by 3 does it work?
Also might be worth dumping the pointer to see where it's at in each version to see if something is amuck
Also might be worth dumping the pointer
Nothing strange about pm2
pointers: 536875026 on Arduino, 536873010 on PlatformIO.
If you don't multiply by 3 does it work?
Yes it does.
Also might be worth dumping the pointer
Nothing strange about
pm2
pointers: 536875026 on Arduino, 536873010 on PlatformIO.
And what is the location of s
?
If you don't multiply by 3 does it work?
Yes it does.
Hmm if the memset doesn't work then the float being invalid is likely not the issue
And what is the location of s?
Nothing funny: Arduino: &s = 536875012, pm2 = 536875026 PlatformIO: &s = 536872996, pm2 = 536873010
Hmm if the memset doesn't work then the float being invalid is likely not the issue
On top of that, shouldn't an invalid float be considered as NaN and propagated in every float computation?
Hmm if the memset doesn't work then the float being invalid is likely not the issue
On top of that, shouldn't an invalid float be considered as NaN and propagated in every float computation?
I don't worth floats very often in C, but I wouldn't leave anything to chance here. At this point I would recommend objdumping the assembly code in the .o files and see if there is a difference in the type of instruction used for the multiplication
Configuration
Operating system: Windows 11
PlatformIO Version: Core 6.0.2 - Home 3.4.2
Description of problem :
The code below targets an Arduino 33 BLE. It runs correctly when compiled and uploaded from the Arduino IDE, but it hangs when compiled and ran from PlatformIO.
Steps to Reproduce
Actual Results
Terminal output:
Expected Results
Terminal output:
Source file to reproduce issue:
Additional info
As far as I can tell, this is a minimum repro code: changing one single element (size of the struct, casting through function f, final multiplication) leads to a working code.