cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_Programmer_CLI #Write8 -w8 [scripts attached]

simosilva
Senior

Hi,

I'm able with the following script "myScript.prg" to write a single byte of data:

-c port=SWD
#Write8(0x08000428,0xAB)

This script is then called with the batch:

STM32_Programmer_CLI.exe -script myScript.prg

But the problem here is that there's no possibility in this .prg script to parse external files and write in memory the content of this file.

Note: with this script the content is written in flash, no matter what the memory content is, same as writing a byte into the STM32CubeProgrammer user interface.

When I use this command instead, the write fails:

STM32_Programmer_CLI.exe -c port=SWD  -w8 0x<address> 0x<value>

The error message in the cmd is:

Error: Downloading 8-bit data failed...
If it's a Flash memory, it may be not erased or protected

Tought that the problem might be the 32 bit alignment or not erasing the memory first.

So I tried erasing the entire sector (just for testing purposes) and then again using the -w8 but nothing changed.

How can I write just some bytes in flash, leaving the rest of the sector untouched, without using -script .prg?

You can find the 2 scripts in the attachments to test yourself easily.

Thanks for the help

2 REPLIES 2
simosilva
Senior

@Imen DAHMEN​ @Khouloud OTHMAN​ 

simosilva
Senior

It's frustrating that a subscript can accomplish a certain task when the calling program can't, both uses STM32_Programmer_CLI.exe, the code is shared so potentially they can do the exact same stuff!

Woldn'd be much easier to share with users some routines just made with a series of STM32_Programmer_CLI.exe commmands, to accomplish basic tasks such as the write operazion of a single byte of memory without errors?

For example, in pseudocode:

write the entire sector containing the byte to be changed
put the desired byte in the correct position on the read binary (how?)
erase the entire sector containing the byte to be changed
write the modified binary in the sector

This is what probably is made into the script, looking at the slow timing in doing such a simple operation like writing a byte, and probably is the exact same procedure also when writing a single byte using STM32CubeProgrammer...

Some simple answer please?