Kirk Humphries

Flashing problem

Discussion created by Kirk Humphries Employee on Jan 29, 2006

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.

 

Posted: Tue Oct 4, 2005  1:13 pm

 

Hello all,

 

While flashing I am getting the error "Fash programming error around address 0x000000" we are using Lauterbach TRACE32 debugger. Linker file is using far text Segments(+seg .ftext). If I use text segments for another project absolutely there is no problem, but I can't use text segments for my project.

 

Your help would be appreciated

 

Thanks & Regards,

 


 

Posted: Tue Oct 4, 2005  3:03 pm

 

In my opinion the problem is with the linearization of the paged memory. As I remember the Trace32 treats e.g. 0x003E1234 as 0x1234 on page 0x3E. This is the format what for example Metrowerks is using by default but differs from the linearized addressing what P&E is using (and what is so unnatural for me).

 


 

Posted: Wed Oct 5, 2005  9:23 am

 

Thanks for the reply.

 

I am working on MC9S12DJ128 microcontroller. I am using COSMIC compiler for compiling the source code and TRACE32 debugger. I am using linker file like this

 

# LINK FILE FOR 9s12xx32 On-chip application (64K Flash and 4K RAM)

# The +def things are used in the startup code

+seg .data -b0x1000 -nIRAM -m0x1000 -sRAM # 4K Bytes RAM for Variable storage

+seg .bss -aIRAM -sRAM

+def __sbss=@.bss # Section where unitialized vars are put

 

#we have 64k flash, 1k eeprom 4k ram

 

+seg .ftext -x -b0x4000 -m 0x3000 -nCODE -sFLASH -ck # Flash

-ck= include this in cksum

+seg .const -aCODE -nCONST # -x = allow seg to overflow into next

.txt

+seg .cksum -aCONST -ncksum -ik

can_drv.o

cangen_drv_test_app.o

diag.o

gmlcal.o

gmlvers.o

gmnm.o

il.o

ilpar.o

otim.o

tpmc.o

vstdlib.o

Crtsi_s32.o

 

+seg .ftext -x -b0xC000 -m 0x3F7F -nCODE2 -sFLASH -ck # Flash -ck=

include this in cksum

 

# "C:\COSMIC\CX12\Lib\libe.h12" # HCS12 Byte EEPROM Libraries (byte EE not availble on C32)

"C:\Program Files\COSMIC\CX12\LIB\libi.h12" # Integer Library

"C:\Program Files\COSMIC\CX12\LIB\libm.h12" # Cosmic HC12/HCS12 Machine Library (required)

 

 

+seg .const -b 0xFF80 -sFLASH # Vectors at logical address 0xFF80

vect_HCS12C.o

 

+def <mailto:__memory=@.bss> __memory=@.bss # End of Global RAM Space

+def __stack=0x1FFF # Top of stack address

 

With this settings compilation is successful but am unable to flash the code into target board by using TRACE32 & BDM MULTILINK(It is not converting all logical records to physical records).For all other projects if i dont select +seg .ftext everything is fine.

 

I dont know how to allocate memory for different segments like for text,.ftext.

 

Please suggest me I had struck up here.

 

Your help would be appreciated.

 

Thanks and Regards,

 


 

Posted: Wed Oct 5, 2005  11:04 am

 

Try this:

 

+seg .ftext -x -b0xf4000 -m 0x3000 -nCODE -sFLASH -ck

+seg .ftext -x -b0xfC000 -m 0x3F00 -nCODE2 -sFLASH -ck

 

I just barely remember to the cosmic linker format because I use Metrowerks since years. I think that you shall trick the addressing if you want to locate the program to the paged area (I mean the values after -b and -m in the lines above).

 


 

Posted: Wed Oct 5, 2005  12:06 pm

 

Hi,

 

Now I changed linker file so I am able to flash the code but it is not working when I say run in the debugger.I hope the code is not mapped correctly into the memory. Now my linker file

 

+seg .const -b 0xfc000 -o 0xc000 -n .const -s flash # constants unbanked

(page 7)

+seg .text -a .const -n .common -s flash # Page 7 unbanked

+seg .vector -b 0xfff80 -o 0xff80 -s flash # vectors start address

+seg .data -b 0x2000 -m 0x2000 # data start address

+seg .eeprom -b 0x800 -m0x800 # eeprom start address if needed

+def <mailto:__sbss=@.bss> __sbss=@.bss # start address of bss

 

+seg .ftext -b 0xf4000 -o 0x8000 -w 0x4000 -m 0x18000 -n .pages -s flash

# Pages 0 to 5

# enter object files for banked pages 0 to 5 here

can_drv.o

cangen_drv_test_app.o

diag.o

gmlcal.o

gmlvers.o

gmnm.o

il.o

ilpar.o

otim.o

tpmc.o

vstdlib.o

 

+seg .text -b 0xf8000 -o 0x4000 -m 0x4000 -n .page6 -s flash # Page 6

unbanked

# enter object files for page 6 here

+seg .text -a .common -n .common7 -it -s flash # Page 7 unbanked

"C:\Program Files\COSMIC\CX12\Lib\crtsi.h12" # startup file (or

crtsi.h12)

# enter object files for page 7 here

 

vect_HCS12C.o # interrupt vectors

"C:\Program Files\COSMIC\CX12\Lib\libi.h12" # C Library (if needed)

"C:\Program Files\COSMIC\CX12\Lib\libm.h12" # Machine Library

 

+def <mailto:__memory=@.bss> __memory=@.bss # symbol used by library

+def __stack=0x4000 # stack pointer initial value

 

Any comments on this? I am trying with different address ranges.

 


 

Posted: Wed Oct 5, 2005  3:55 pm

 

You did not say that you want to get it run also You have just

complained about the flash programming error...

 

Just kidding

Message Edited by khumphri on 01-28-2006 08:35 PM

Outcomes