2015-09-02 06:04 AM
Hi,
I am wondering if there is an example for IAP using cube for STM32F0? I have found an example for STM32F1 and modified it for my board, STM32F070rb nucleo. I can load an application using the iap, but I have not yet changed the vector table since M0 can't relocate the vector table. Is there an example code for this using cube/hal api? thanks2015-09-02 07:12 AM
I found code for IAP using Standard Peripheral Library. For Cube I guess it should be like this:
uint32_t *VectorTable = (uint32_t *)0x20000000; for(i = 0; i < 48; i++) { VectorTable[i] = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2)); } /* Enable the SYSCFG peripheral clock*/ /* RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE); standard library*/ __HAL_RCC_SYSCFG_CLK_ENABLE(); /* Remap SRAM at 0x00000000 */ /*SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM); standard library */ __HAL_SYSCFG_REMAPMEMORY_SRAM();2015-09-02 08:21 AM
Make sure you advance, and shrink, the RAM allocation provided to the linker so it doesn't walk on the vector table.
You can confirm things are getting into the right space by using a debugger to look at the memory, both at 0x20000000 and 0x000000002015-09-03 03:23 AM
Hi,
Thanks for the advice. I am using uVision. Here are my current settings for my application sw: IROM1:0x08004000 size 0x1C000 IRAM1: 0x200000C8 size 0x3F38 I have allowed my IAP code have all the SRAM(16KB). Should I have seperate/devide the SRAM memory for IAP and the application? I have verified the memory after the application is started. 0x0000_0000, 0x0800_4000 and 0x2000_0000 have the same data at the beginning. Right now I am using IAP sw to upload my application and it seems to work fine, but when I load the application directly from the debugger it fails. I guess it must be some setting I am missing.2015-09-03 04:01 AM
I forgot to build the application for 0x0800_0000 when I launch the application directly from the debugger.