2014-11-14 05:02 AM
Hi all,
I am trying to implement IAP over I2C in my STM32L151CB processor. I have a IAP-program and a Main Application-program. These two programs are completely separate uVision projects in the Keil development environment. I have allocated the IAP-program to flash address (0x08000000) and the Main Application-program to (0x08010000), just for test. Right now all the IAP-program is doing is to jump to the Main Application-program. uint32_t JumpAddress; uint32_t APPLICATION_ADDRESS = MainProgramStartPage; // Base of main application program 0x08010000 JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); // Always set the application base address + 4 (This is where the init program starts) Jump_To_Application = (pFunction) JumpAddress; // Set the address __set_MSP(* ( __IO uint32_t* ) APPLICATION_ADDRESS); // Set Stack Pointer Jump_To_Application(); // Jump to addressThis seems to work. But when the Main Application-program is running it does not store the variables in my buffers anymore. It seems that the two programs are interfering with each other in the SRAM. But when I try to change the SRAM start location of the Main Application-program from (0x20000000) to (for example: 0x20002000), the program does not work at all!?Is there something I dont know about the SRAM, since I can not change its location without crashing the program? I want the two programs to be completely separate. With allocated flash and SRAM for each. Any answer is greatly appreciated, Kind regardsKenneth #flash #i2c #iap #stm32l1xx #stm32l2014-11-17 08:14 AM
Hi
''This seems to work. But when the Main Application-program is running it does not store the variables in my buffers anymore.'' Have you tried debugging the application program? ''But when I try to change the SRAM start location of the Main Application-program from (0x20000000) to (for example: 0x20002000), the program does not work at all!?'' You must change the address locations in the linker script or of course it will not work! When the application runs, does it run a piece of assembler which copies the initialised variable from Flash into RAM? (This init routine should be what is jumped to by the bootloader, it is often created by the development tool/enviroment)2014-11-17 08:58 AM
You should be able to create images at different FLASH addresses, and using the same RAM space, or at least ''reuse'' the space in the application after the loader relinquishes control. The jump should be a one-way trip, and the loader shouldn't leave hardware and interrupts hanging in awkward states.
You'd be well advised to review the .MAP files of the two images, and that the SystemInit() coded, and the stuff it calls, don't break the clocks, or get the vector table pointed to the wrong code base.