cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to run Bootloader code from RAM in STM8S105K6

raghavendra2
Associate II
Posted on November 21, 2009 at 16:54

Unable to run Bootloader code from RAM in STM8S105K6

13 REPLIES 13
raghavendra2
Associate II
Posted on May 17, 2011 at 15:04

Hi,

I'm writing a bootloader which does only programming of flash.

I took the input from ST application notes. I'm trying to run the bootloader from RAM, control is able to ''Bootloadermain()'' @ RAM (bootloader main fun) but failing to run from that location.

I'm using _fctcpy('') for copying the bootloader code to RAM supported only in COSMIC compiler.

Please give me your input to resolve the problem.

Best regards,

Raghavendra

cgha21
Associate II
Posted on May 17, 2011 at 15:04

I think you should copy the flash_write and erase function to ram rather than the total iap application.

The stm8s_flash.c locate these functions in .FLASH_CODE section. Then you should add it in the

project setting -> linker -> category -> input ->ram. Don't forget to change the option to -ic. Then you can use the fctcpy to copy it to ram.

raghavendra2
Associate II
Posted on May 17, 2011 at 15:04

Thank you for reply. Since my RAM code does only reading from UART and writing to FLASH(Size of bootloader code is 300bytes). Can't I directly run from RAM? as you told, I have defined FLASH_CODE section in RAM

Thanks,

Raghavendra

[ This message was edited by: raghavendra.hn on 20-08-2009 12:23 ]

mozra27
Associate II
Posted on May 17, 2011 at 15:04

Hi Raghavendra,

You must add the dedicated FLASH byte operation functions that you use in your application (copie/paste the needed functions in the stm8s_flash.c after the FLASH_CODE section definition)

Yes you can run from RAM if your code lowers than RAM size.

Regards

mozra

raghavendra2
Associate II
Posted on May 17, 2011 at 15:04

Hi,

Thanks for the input. I'm unable to erase the flash from my bootloader code. I could only erase part of flash i.e., only i could erase first two blocks of the FLASH. It is not erasing from 0x8100. Please help me to resolve this issue.

Thanks,

Raghavendra

mozra27
Associate II
Posted on May 17, 2011 at 15:04

Hi Raghavendra,

Can you please check the size of the user boot code area by checking the user boot code (UBC) option byte value, normally the bootloader area is read/write protected.

For more details you can refer to user boot code area as described in reference manual (RM0016) ''Section 4.4.1: User boot area (UBC)''.

Regards

mozra

raghavendra2
Associate II
Posted on May 17, 2011 at 15:04

Hi Mozra,

Thanks for the input.

Please note I'm not using UBC. I'm copying the code to RAM. Code size is 700Bytes which is within RAM size(2K). But still i could erase using

RAM code.

Regards,

Raghavendra

mozra27
Associate II
Posted on May 17, 2011 at 15:04

Hi Raghavendra,

What is the clock speed used in your application? if higher than 16MHz

please try with wait state = 1 and keep us informed

Regards

mozra

jacekkedzior
Associate
Posted on May 17, 2011 at 15:04

Hello

In my application i need the bootloader to be able to update firmware without rainsonance programmer. I have never used the bootloader and boot loader manual (um560) gives no guidance on how to start with bootloader. Could you please give me a step by step giude how to enable boot loader support on STM8s207 and how to use flash loader demonstration to upload new BIN file to this microcontroller?

Regards

jackkpl