cancel
Showing results for 
Search instead for 
Did you mean: 

IAP for STM32F0 using STM32Cube

seed
Associate III
Posted on September 02, 2015 at 15:04

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?

thanks
4 REPLIES 4
seed
Associate III
Posted on September 02, 2015 at 16:12

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();

Posted on September 02, 2015 at 17:21

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 0x00000000

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
seed
Associate III
Posted on September 03, 2015 at 12:23

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.

seed
Associate III
Posted on September 03, 2015 at 13:01

I forgot to build the application for 0x0800_0000 when I launch the application directly from the debugger.