How to use openocd to write entire row of Sflash

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

cross mob
WaLo_3890256
Level 2
Level 2
5 replies posted 10 questions asked 5 questions asked

Hello,

We need to pre-program Sflash before programming the application to PSoC6.

If we need to write 64 bytes of hex value such as "cdaa5e5bbc31ed47b9e1f5b07b919815c2e1dde780d9b4701c01f812cad407ef"

Is there any command can write hex value into entire Sflash row?

I have studied "Cypress Programmer 2.1 OpenOCD" but there's only write 4 bytes at one time

./openocd.exe -s ../scripts -f ../scripts/interface/kitprog3.cfg -f ../scripts/target/psoc6.cfg -c "init; reset init; flash fillw 0x16000800 0xcdaa5e5b 4; shutdown"

If I write next 4 bytes into next offset 0x16000900:

./openocd.exe -s ../scripts -f ../scripts/interface/kitprog3.cfg -f ../scripts/target/psoc6.cfg -c "init; reset init; flash fillw 0x16000800 0xcdaa5e5b 4; shutdown"

The previous value would be earsed.

Below is the way I used to read value form Sflash in my application:

uint8_t otp_key1[4] = {0};

uint8_t otp_key2[4] = {0};

emcpy(otp_key1, (const void *)0x16000800, 4);

memcpy(otp_key2, (const void *)0x16000900, 4);

Please correct me and help if my way is suitable.

Thanks.

BR,

Wayne

0 Likes
1 Solution
Vison_Zhang
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 250 sign-ins

flash rmw <address> <data> ocd command can be used to program multi-bytes data into dedicate address of FALSH/SFALSH region.

View solution in original post

0 Likes
4 Replies