2022-07-26 08:43 AM
Hello everye one, i have a customized bootloader and firmware, i need pass som argument from the first one to the last one, in both project, at linker scripr file i have the following:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 12K
SHARED (xrw) : ORIGIN = 0x20002000, LENGTH = 8K
FLASH (rx) : ORIGIN = 0x8009C00, LENGTH = 25K
}
SECTIONS
{
.shared_mem :
{
. = ALIGN(4);
__shared_mem_start__ = .;
*(.shared_mem.key)
*(.shared_mem.ID)
*(.shared_mem*)
__shared_mem_end__ = .;
} > SHARED
as you can see i created a SHARED area and shared_mem into, and the application project has the same defined area, and then in the main.c files has thes two lines
__attribute__((section(".shared_mem.key"))) volatile uint32_t VERSION[20];
__attribute__((section(".shared_mem.ID"))) volatile uint32_t ID[20];
if i compile, everything is okay, but when i try to write something in VERSION from the bootloader, the file's size step up a lot, like 300Kb, so if i code the following:
VERSION[0] = 1;
it makes file.bin increase its size a lot and then i cannot flash the MCU because of its size.
Do know someone what's going on?
thanks a lot in advance.
2022-07-26 08:48 AM
add the (NOLOAD) attribute to .shared_mem output section
.shared_mem (NOLOAD):
{
[...]
}
JW
2022-07-26 09:03 AM
Hello, nice the problem has been solved, now the problem is, when bootloader jumps to app, HAL_Delay seems doesn't work, at the begin i put:
SCB->VTOR = 0x8009C00;
__enable_irq();
but it doesn't work yet i am not sure whether new memory are has nothing to do with this problem...
2022-07-26 03:13 PM
Do you transfer control from an interrupt or callback routine?
Check that the Systick interrupt has been enabled and that it's being called.
2022-07-27 12:36 AM
Hi there, i hope you fine! i use this code to jump from the boot to the app:
typedef void (*pFunction)(void);
void jumpApp(){
uint32_t jumpAddress;
pFunction jump_to_app;
jumpAddress = *(uint32_t*) (FLASH_APP_ADDR + 4);
jump_to_app = (pFunction)jumpAddress;
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOD_CLK_DISABLE();
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();
HAL_RCC_DeInit();
HAL_DeInit();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
__disable_irq();
__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
__set_MSP(*(uint32_t*)FLASH_APP_ADDR); //Stack
jump_to_app();
}
How can i enable the systick interrupt?