Code compiled as Release behaves different than Debug code
- December 16, 2016
- 4 replies
- 2376 views
Hello experts.
Currently I experience a very strange problem with my firmware for a STM32F334.
I just switched from the debug configuration to release, uploaded the code to the device and it behaves totally different.First of all being programmed with St-Link it does not start at all. If I program the device by the debug environment it starts, but does not work correct. To name it exactly, there is a timer for frequency measurement counting on an external clock. The data is collected by a DMA channel with a samling rate of 5 kHz. This fails at some point (not sure where) and a security mechanism is triggered.
I use a modified linker script and a modified startup file since I have initialized data in CCMRAM. Please find the files attached. Thus, I also use a different objcopy command to create the binary image for the flash memory:
arm-none-eabi-objcopy -R .data -R .ccmram -R .ccmidata -R .bss -O binary '${BuildArtifactFileBaseName}.elf' '${BuildArtifactFileBaseName}.bin'
The pehripheral initialization is the same for release or debug firmwares. I have the same optimization level for both as well. But, there are no debugging symbols in the release firmware. Because of this and because I do not expect different hardware timinigs with a connected debugger, there is probably something wrong with the linker script, the startup code or the objcopy command.
I'm not sure what information I can proivde in addition... Please ask if there is any.
My platform is Eclipse with SW4 and I do use the StdPeriph library and the arm-math library (but not in precompiled form).
Best regards,
Martin.