ARM Cortex M3 (LPC1519)
I wrote a bootloader (which still works) that runs in flash memory and writes a program to Flash (behind the bootloader). The program is written and starts to work properly (at least during debugging).
When I use the SEGGER Ozone debugger, I can set the breakpoint to "main" and execute the firmware. However, when I run a large operation in the code (to another breakpoint), I always get unexpected interrupts:
- UsageFault_Handler
- BusFault_Handler
- and etc.
This does not happen when I execute a code command with a command. This means that interrupts will not work properly.
The program works fine when I flash it to address 0x00000000. I changed the script builder so that the origin lies at a later offset (where the loader places the firmware).
Anyone having similar problems?
Thanks Johann
PS: sorry, I can not provide a minimum sample, because I do not know where to start
Edit - Additional Information:
Now I have downloaded a small project where I can find an error in the debugger. There is a uint32_t variable in the structure, which seems to cause an error. It says:
Mis-alligned memory read: Address: 0x00001596, NumBytes: 8, Alignment: 4 (word alignment)
In fact, 0x1596 is not decrypted to 4, so the error is justified, but how can it be? Should the compiler not care about aligning variables in structures?
- :
, IRQ USART0 (txReady).
, ?
ARM Cortex SysTick (SysTick_Handler) !?
[[noreturn]]
inline void startFirmware(std::uint32_t address) noexcept
{
const auto ptr = reinterpret_cast<std::uint32_t*>(address);
SCB->VTOR = address & SCB_VTOR_TBLOFF_Msk;
__set_MSP(*ptr);
const auto resetHandler = *(ptr + 1);
reinterpret_cast<internal::ResetHandlerFunction>(resetHandler)();
while(true);
}
- :
, , USART, CCTimer .., , .