2024-08-29 01:08 AM
We are building code for our STM8S208RB (using SDCC), and we have noticed some behaviour we can't explain.
We first observed that our program suddenly stopped working after we included a new file that contained some functions, but none of those were actually called yet. So the project builds just fine with and without that file included in the build. However, it does not run. If we then comment out some functions, it suddenly starts working again. As mentioned, none of these functions are actually called, simply them being there seems to cause the crashes.
One hint we found that may or may not be relevant is this:
On the working binary (17635 bytes) we have this:
```
010CE3 49 __start__stack:
```
And on the non working binary (17692 bytes) we have this:
```
010D1C 49 __start__stack:
```
Our compile commands are like this:
```
/usr/bin/sdcc -I/workspaces/our-project/include -I/workspaces/our-project/libraries/STM8S_StdPeriph_Driver/inc -DSTM8S208 -mstm8 --opt-code-size --model-large <OUR_SOURCE_FILES>
```
Link.txt looks like this:
```
/usr/bin/sdcc -DSTM8S208 -mstm8 --opt-code-size --model-large <OUR_SOURCE_REL_FILES> --code-loc 0x8000 --data-loc 0x0001 PeriphDriver.lib
```
Any clue what might be the issue?
Thanks a lot!