Hi,
I've been attempting to do some programming of the internal flash on a MCF51JM128 MCU. After several frustrating attempts I tried using AN3942 and the accompanying software as a starting point.
I compiled the project and ran it on a DEMOJM board. It worked fine except for one thing. The flash was programmed from address 0x910 not 0x1000 as it was supposed to. I noticed that the linker command file specifies that the code starts at 0x410, so I tried an experiment and changed it so that the code would start at 0x500 instead. Now when the code is executed it programs the flash at address 0xA00 instead. It seems like there is some sort of offset being added (or subtracted) from the intended programming address and it is dependent on where the start of the code is situated.
Has anyone any ideas on this? Better yet has anyone got some simple proven & reliable flash erase and flash programming routines for the coldfire v1 devices?
> Better yet has anyone got some simple proven & reliable flash erase and flash programming routines for the coldfire v1 devices?
Sure, you can see flash programming routines for CFV1, CFV2, PIC32 and a bunch of others in my skeleton project at the bottom of this page:
http://www.cpustick.com/downloads.htm
You'll want the file sources/flash.[ch], and you'll want to follow the MCF51JM128 #if's.
There are files there for manipulating most of the other JM peripherals as well -- anything I expose to BASIC thru StickOS. (You can also load StickOS up on your JM if you want to play with it and see what peripherals it can control and how.)
You'll see examples of linking it for the bootloader (follow #BADGE_BOARD #if's and use the badge.lcf linker file) or for absolute flash location (use the 51JM128.lcf file).
-- Rich