Equip yourself to optimize AURIX™ MCUs for Evs at the EV Webinar. Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Forum Discussions

Level 1
Level 1

Recently I've bricked one of the tc397xe while flashing UCB with trace32.
While investigating what happened i've reached comment from Lauterbach cmm scripts that states that Flash.AUTO should be used for programming UCBs instead of Flash.ReProgram.

Do you know how Flash.AUTO differs from Flash.ReProgram and how using Flash.Reprogram could lead to damage of UCB?

2 Replies
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
Good question for Lauterbach - the documentation isn't that clear to me. My guess is that FLASH.AUTO can do incremental programming - i.e., if UCB contents are changing from 0 to some value, it just writes the new values without erasing. I think FLASH.ReProgram will read/erase/reprogram a whole sector.
Level 4
Level 4
5 solutions authored 5 questions asked 25 sign-ins

Hello anyone,

I was curious about this content, so I looked it up.
TRACE32 Manual (NorFlash.pdf) describes as follows about FLASH.ReProgram command.
//norflash.pdf Page-20
//FLASH.ReProgram Command (Target-controlled)
The command FLASH.ReProgram is the best choice for target-controlled FLASH programming.
It provides an optimum FLASH programming performance by reducing the erasing and programming cycles to a minimum:
- Only not-empty sectors are erased.
- Only modified sectors are programmed.

Also, TRACE32 Manual (NorFlash.pdf) describes as follows about FLASH.AUTO command.
//norflash.pdf Page-31
//The FLASH.AUTO Command
The command FLASH.AUTO is a special command that allows:
- to set software breakpoints to FLASH
- to patch code located in FLASH

Therefore, I recognized as follows.
- FLASH.ReProgram command: Used when Flashing to multiple sectors.
- FLASH.AUTO command: Used when writing to one target sector.

In addition, FLASH.AUTO and FLASH.ReProgram seem to Erase the target sector when the command option <off> is executed, and then write.
// general_ref_f.pdf Page-37
NOTE: The FLASH.AUTO off and FLASH.ReProgram off commands automatically erase the modified sectors before writing them.
Consequently, do not use FLASH.Erase when using the auto or FLASH reprogramming mode. If you do, you will lose the advantage of reprogramming only modified sectors, which will result in a loss of performance.

The content related to the potential for UCB damage when using Flash.Reprogram command is:
//norflash.pdf Page-27
If TRACE32 tool-based FLASH programming is used, the reprog state is handled differently:
The following actions are taken, when TRACE32 performs a write access on a sector:
1. The corresponding sector in the Virtual FLASH Programming Memory is marked as pending.
Due to performance reasons no erase status is checked and no checksum is calculated for the target FLASH sector.
2. The corresponding sector is erased in the Virtual FLASH Programming Memory.
3. The new data is copied to the corresponding sector in the Virtual FLASH Programming Memory.
If the recommended command sequence for the FLASH.ReProgram is used, no performance benefit is reached compared to the usage of FLASH.Erase / FLASH.Program.
- Since no erase status is maintained for a target FLASH sector empty sectors are erased.
- Since no checksum is calculated for a target FLASH sector not-modified sectors are programmed.
A reasonable performance benefit is reached, when the Virtual FLASH Programming Memory is not erased before the contents of the programming file is copied. Such a proceeding however includes the risk, that obsolete code remains in unused target FLASH sectors.

You can get each document by searching the internet.
Please take a look if you are interested.

Best regards,