STR7 Flash programming

Hello to everybody. I’m working on STR710, STR730 and STR750 and I use YAGARTO, so I also use OpenOCD. In YAGARTO there are the files (linker, startup, gdb, config) needed by STR710 and I modified them to be used with STR730 and STR750. I succeded in running and debugging my programs in RAM, but I have still a problem: I don’t know how to write and debug my programs in flash. I know someone here succeded in writing flash for at least one of STR710, 730 or 750, so can you help me? For now I’m using a program that I run in RAM and that is able to write one or more words in flash, can I use this program to write in flash the program instead of those words? If not, is there any free STR7 flash programmer? Or can I use other ways? Please help me! Thanks in advance

Hi legolas,

you can find example configs in the OOCD Wiki:

http://openfacts.berlios.de/index-en.ph … CD_scripts

You can use the STR710 example as a starting point.

I use the STR710 (STR711) running from Flash.

I added a link to my reset script in the config which

programs my binary on start of my debugging session:

sleep 500

poll

flash erase 0 0 7

flash write 0 test.bin 0

reset run

sleep 500

I can send you my config and script if you give me your mail address.

Regards,

Joerg

Hi, thanks for your reply. My e-mail address is giacomofazio@tiscali.it. One question about the following lines:

sleep 500

poll

flash erase 0 0 7

flash write 0 test.bin 0

reset run

sleep 500

I know flash writing isn’t allowed by default, don’t you have at first to add instructions to unlock it? Thank you very much

By default writing to the flash is allowed on the str7 family.

If you set the write protection then a flash protect command will need to be used, eg.

flash protect 0 0 0 off

Cheers

Spen

Thank you to everybody, it’s ok now!!!

l3golas:
Thank you to everybody, it’s ok now!!!

Hi,

I was using the RAM to debug my application till now. But after a few lines of code the linker says that my RAM is full. I wonder how I can see what objects are stealing my RAM? Is there a file that is generated by the linker, which shows me the symbols and memeory consumption? My RAM is 65kByte and I don’t think that I can exeed this with my smal program, I mean I just startet!

I use the Linkerfile provided with Anglia IDEalist from STR, which is written for debugging in RAM. Are you using any other linker scripts?

If I swith over to debugging in Flash, are there any major disadvantages compared to RAM debugging?

Hello, I had your same problem at the beginning. RAM has lots of advantages if compared with FLASH: it’s faster to write, it’s quicker to access, when you debug you can use software breakpoints in a unlimited number (while with FLASH you can use only 2 hardware breakpoints). Moreover you can read and write RAM simply, FLASH is a ROM (Read Only Memory), it’s possible to erase and write it, but the operation is done electrically, that’s why erasing and writing are so slow. For all that, RAM is more expensive than FLASH, so you find in you microcontroller less RAM than FLASH. A positive aspect of FLASH is that if you have your program in RAM and you stop giving power supply to your board, when you plug it in again, nothing is present anymore in it. If you write your program in FLASH, after you do the same thing, when you plug your board in, the program is already present, because you can erase FLASH only with a specific operation.

It’s possible that your program doesn’t fit your RAM, this is normal. In fact, sometimes you can write them only in FLASH. I hope it’s clear. Regards,

l3golas

Thanks for your answer!

Is there any option for the linker to get the used memory areas? I mean which memory areas are filled with program data and which are not?

Are you using the linker-script from STR?

Hi, I’m using the linker script from Anglia. Yes, in it you can easily find the various parts of your program and the address where they are put. In particular, my Makefile is done in such a way that when I build a program, at the end of the operation, it shows me all the parts (DATA, CODE, BSS, etc. ) and the addresses of each of them.I’m using a modified version of Martin Thomas’s Makefile. You can find it at this link: http://www.siwawi.arubi.uni-kl.de/avr_p … x_str.html

For now I’m writing a tutorial about the use of OpenOCD, GnuARM and Yagarto for STR7 microcontrollers. I will translate it in English (because I’m Italian) and I will give it to the community, hoping it can help newbies to learn more quickly! When it’s ready, I will post a message on this forum!

Regards,

l3golas

just use {arch}-objdump -t and look at the size column.

Cheers,

–David Carne

busonerd:
just use {arch}-objdump -t and look at the size column.

Cheers,

–David Carne

Hey great that is what I needed!

I can flash my code now into flash, but which commands will I need for arm-elf-insight?

With my old script I get this error:

(gdb) cont
Continuing.

Error: Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x40000c70: (undocumented errno -1).

If you want to debug code running in RAM, use the

arm7_9 sw_bkpts enable

command, otherwise, if running from Flash, use the

arm7_9 force_hw_bkpts enable

command (prefix both commands with “monitor” from within GDB), or explicitly tell the GDB to use hardware breakpoints:

hbreak , thbreak

Regards,

Dominic

Dominic:
If you want to debug code running in RAM, use the

arm7_9 sw_bkpts enable

command, otherwise, if running from Flash, use the

arm7_9 force_hw_bkpts enable

command (prefix both commands with “monitor” from within GDB), or explicitly tell the GDB to use hardware breakpoints:

hbreak , thbreak

Regards,

Dominic

Hi,

is there a way to tell the gdb to use hw-breakpoints even if a normal “break” command arrives? I’m using codeblocks and it sends always normal break commands…

** edit **

I found it myself there is command “set breakpoint auto-hw on” thats works for me…

But crap only two breakspoints! on my 8-Bit Microchip I got 8 brkpts!