cancel
Showing results for 
Search instead for 
Did you mean: 

File in flash at static address

Posted on August 16, 2010 at 18:57

File in flash at static address

8 REPLIES 8
leoren_tm
Associate II
Posted on May 17, 2011 at 15:09

using RIDE you can use this

at 0x8EFF code uint8_t v[]={1,2,3,4,5,6,7,8,9};

in that, data will be at 8EFF ROM, ithink  this a standard C command but some variation on compiler to compiler

Posted on May 17, 2011 at 15:09

yes but i dont want to write my 16KB file inside the code...

another way?

leoren_tm
Associate II
Posted on May 17, 2011 at 15:09

did not get your point, im also new to STM. but ithink there NO feature that you can alter your ROM without using any programmer. but some STM go with this internal EEPROM. or you can have programmer on board

Posted on May 17, 2011 at 15:10

Well I have a programmer the discovery board

for example freescale have an option in the compiler HEXFILE which accept srecord or intel hex file to be put im the cpu at the moment on linking/programming

leoren_tm
Associate II
Posted on May 17, 2011 at 15:10

i guess no option like that at STM8, anyway as on my first reply, i think its a good way too, but again it depends on your requirements :)

sramsauer9
Associate II
Posted on May 17, 2011 at 15:10

Hi julien,

i would suggest the following.

1. You have to reserve the space for the 16KB file in your c code.

2. This can be done by an array variable at a given address

   see also http://www.cosmicsoftware.com/faq/faq3.php

3. Now the tricky part of the solution.

   Actually there is no tool from ST available to flash just a specific area.

4. BUT you can use the STVP programming toolkit.

   http://www.st.com/stonline/products/support/micro/files/um0151.exe

   http://www.st.com/stonline/books/pdf/docs/11472.pdf

5. There is a function in the dll to program a part of the device’s memory

   int EProgArea(DWORD dwAreaId, long FirstAddr,long LastAddr)

6. Unfortunately the apisample.exe distributed with STVP programming toolkit

   does not support the EProgArea function call.

7. So you have to write your own flash-tool or just modify the apisample.exe.

8. The source code can be found in um0151.exe. It is a Visual Studio 6 Project.

   But I used Microsoft Visual Studio 2010 Express to convert and compile the apisample successfully.

   Visual Studio 2010 Express can be found here: http://www.microsoft.com/express/Downloads/#2010-Visual-CPP

   BTW, if you are a student you can download Visual Studio 2010 Professional Edition at

   https://www.dreamspark.com/default.aspx. But Express edition will also do the job.

9. Add the EProgArea-function with new commanlineswitch -FileProgArea to apisample source and save it as APISampleExtended.exe

10. Now you can program the device using the default -FileProg switch.

    (Remeber the array variable will reserve the needed space for 16KB file)

11. Next use APISampleExtended.exe to program the 16KB file to flash memory.

Example command line for STM8S-STM8S207R8:

APISample.exe -BoardName=ST-LINK -Device=STM8S207R8 -Port=USB -ProgMode=SWIM -no_loop -no_log -FileProg=myProg.s19

APISampleExtended.exe -BoardName=ST-LINK -Device=STM8S207R8 -Port=USB -ProgMode=SWIM -no_loop -no_log -FileProgArea=myFile.s19,0x14000

Regards

Stefan

Posted on May 17, 2011 at 15:10

Thanks seem the best solution out there

if I do it ill try to post the extended app so other may use it too    

jdf25252
Associate II
Posted on May 17, 2011 at 15:10

Unless I'm missing something, you should be able to do what you want by using STVP.  You'll have to create a project.  Once you've done that click on Project:Edit and in the Properties tab unselect the ''Clear memory before loading file'' check box.

You can then use File:Open to load multiple .s19 files into the buffer.

jdf