The code ships with ROM and RAM linker settings - but only the RAM version will likely work in your case. Try to read the second word (32 Bit little endian) from your binary - it should point to an odd address in the 0x20000000 range, as it is the new PC value.
Start bootloader from firmware
-
20-06-2023 - |
Pergunta
I wish to be able to start the bootloader directly from the code without having to have a pin high and reset the microcontroller to access it. The idea below is that the bootloader binary is stored in a char array. When Start_BootLoader() is called, the bootloader is copied into SRAM and executed.
However, the code copies into RAM but when it attempts to execute the code at the location I have copied it to, it does nothing.
The micro. is an Energy Micro EFM32380f1024. The code below that I am using is based on Energy Micro's application note AN0042.
void Start_Bootloader(void)
{
/* Diable interrupts */
INT_Disable();
__set_MSP( ( 0x20000000 + sizeof( bootloader ) + 0x400 ) & 0xFFFFFFF0 );
/* Load the entire bootloader into SRAM. */
memcpy( (void*)0x20000000, bootloader, sizeof( bootloader ) );
/* Start executing the bootloader. */
BOOT_jump( *(uint32_t*)0x20000000, *(uint32_t*)0x20000004 );
}
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow