cancel
Showing results for 
Search instead for 
Did you mean: 

Flashing boot-loader, production-data and application

Rami Rosenbaum (old)
Associate II
Posted on May 29, 2017 at 14:01

hi,

I'm working on a project, on a stm32F101.

The product is a proprietary boot-loader and application (which can be updated later on, via the BL).

I'll need to hold some production-data, serial-number, etc, less than 256 bytes.

I'm short in storage, don't want to waste a whole sector.

I want to hold it in a known location, for the application to read, say address 0x08000100, enough for the boot-loader vector-table.

I'm trying to flash the 3 via ST-Link Utility command-line interface, but they erase one another.

How can I Skip Flash Erase?

I'm flashing the boot-loader:

ST-LINK_CLI.exe -c SWD -P BootLoader.hex -V

I'm flashing the serial-number:

ST-LINK_CLI.exe -c SWD -P SerialNumber.bin 0x08000100 -V

I'm flashing the application:

ST-LINK_CLI.exe -c SWD -P Application.bin 0x08008000 -V

My additions to boot-loader linker script:

define symbol __ICFEDIT_intvec_start__                = 0x08000000;

define symbol __ICFEDIT_region_ROM_PRODUCTION_start__ = 0x08000100;

define symbol __ICFEDIT_region_ROM_PRODUCTION_end__   = 0x080001FF;

define symbol __ICFEDIT_AppHeader_start__             = 0x08000200;

define symbol __ICFEDIT_region_ROM1_start__           = 0x08000000;

define symbol __ICFEDIT_region_ROM1_end__             = 0x080000FF;

define symbol __ICFEDIT_region_ROM2_start__           = 0x08000200;

define symbol __ICFEDIT_region_ROM2_end__             = 0x0801FFFF;

define region ROM_region     = mem:[from __ICFEDIT_region_ROM1_start__ to __ICFEDIT_region_ROM1_end__] | mem:[from __ICFEDIT_region_ROM2_start__ to __ICFEDIT_region_ROM2_end__];

define region ROM_production = mem:[from __ICFEDIT_region_ROM_PRODUCTION_start__ to __ICFEDIT_region_ROM_PRODUCTION_end__];

Thanks

#linker-script #st-link-utility
1 ACCEPTED SOLUTION

Accepted Solutions
Jeroen3
Senior
Posted on May 29, 2017 at 16:22

With -w8 ?

You do know have to erase flash to program 1's. You can only program 0's.

View solution in original post

8 REPLIES 8
Jeroen3
Senior
Posted on May 29, 2017 at 16:22

With -w8 ?

You do know have to erase flash to program 1's. You can only program 0's.

Posted on May 29, 2017 at 16:31

-w8/-w32 writes 1/4 bytes to flash.

Easier for me to write the full serial-number with

-P SerialNumber.bin

, after all, the SN is generated by a production-tool.

But - that's not the issue, I didn't write the flash driver, I only have the ST-LINK_CLI.exe interface...

How should I use it correctly?

Posted on May 29, 2017 at 19:19

Can you have the serializer, or other app, combine the .hex and .bin into a singular .hex that's burned in one operation?

Can't say I've battled my way through the ST-LINK command line.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 29, 2017 at 19:44

Hi Clive,

It's quite easy extending the BootLoader.hex with the SerialNumber, knowing HEX file format, but it seems incorrect design.

BootLoader may be updated, grow bigger (while it's vector-table can't), SerialNumber can't change - that's the reason for putting the SN in this exact address.

I prefer a method of injecting each element without ST-Link Utility erasing other addresses.

P.S. - are the changes in the linker icf-file correct? Will 

region ROM_production

be omitted from BootLoader.hex?

Thanks

Posted on May 29, 2017 at 21:20

I'm not using IAR, but it looks reasonable. Check the .HEX, it should be reasonably apparent if there is a void in the memory described.

I understand that the boot loader might change, and the serial/calibration data won't, but you're production programming at the factory, so you have precise control over what gets into memory on day zero. In the field presumably the boot loader takes the role of updating the application, or itself. Different F1 parts have different erase page sizes, not looked up yours or using F1 parts currently.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 29, 2017 at 21:51

HEX file is perfect, addresses 0x0100-0x01FF missing.

F101 has 128 sectors of 1KB - I can't 'waste' a whole 1KB on production data.

I can live with your option, but still hoping to find the Skip Flash Erase in the command-line utility...

Posted on May 30, 2017 at 07:27

maybe

-no_erase

will do the job.

launch

STVP_CmdLime.exe -help

to see all available options.
Posted on June 01, 2017 at 08:42

Thanks Max,

I'm not familiar to the STVP and didn't find any documentation about the STVP_CmdLime.exe.

Production is beyond the scope of my project, so I will not spent time learning the tool.

Jeroen3's solution (-w8) works well, a few lines of code in the calling script - no problems.

I'll open a separate post regarding theSkip Flash Erase missing option.