Locating code in flash (text space in GCC speak)

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Having spent some time searching the site and experimenting with various options I have come to the conclusion I can not 'cut a hole' in flash at a predefined location, say hex address 0x200 for 30 bytes, and write code into it.
Could this be confirmed or denied please.

Yes I am getting grumpy!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You cannot really cut a hole, but you can manipulate a lot
if you'd really like to touch the linker scripts. If all
you need is to place a certain piece of code e. g. to a
256-byte boundary, you'll probably be better by locating
that region to the top of (application, in case it matters)
ROM since then, the compiler can use the entire lower part of
the ROM the way it likes. Making the code ``flow around''
your hole is a lot more difficult than turning the hole into
an edge, so to speak.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunatly I have already produced several units using the IAR compiler which enables easy 'hole cutting' and have alocated an area within flash to contain information on the firmware and unit it is for. This information is then usd by a downloader to decide if the code is for the unit it is being aimed at.

Yes I am getting grumpy!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would it be possable to write the section of code in assembler and give it an org at the required address, so forcing the linker to place the string where required?

Keep it simple it will not bite as hard