IAR HCS12 Banked memory code

Started by Real Live One October 18, 2005
Hi there,

I'm using a MC9S12DP512 with a P&E USB BDM. I have problem getting
the code to the chip using Banked code model. Using the normal code
model everything is fine exept that i'm limited in size.

In banked memory mode, building goes well exept that loading the code
to the chip using debug function will generate the following fatal error:

Tue Oct 18 16:43:08 2005: Flash Programmer: Verify error when
programming at (0x408000-0x40800a).

Map file does not give any clue about something being program at
address 0x408000.

Removing the option to link library(usely set as normal), I was able
to upload the code to the chip but then the code would not work (a
simple led flashing in a while(1)) and the following error is generated:

Tue Oct 18 16:38:41 2005: Loaded debugee: U:\Debug\Exe\test iar
develeper.d12
Tue Oct 18 16:38:42 2005: Target reset
Tue Oct 18 16:38:42 2005: Driver does not support code coverage.
Tue Oct 18 16:38:42 2005: Error: Operation error.
Tue Oct 18 16:38:42 2005: Couldn't go to 'main'.

Even a manual reset does not start the program.

I'm using the default setup(no external ram, flash or anything..
simply mCPU w/clk & bdm)

Anyone has a clue what to do?

Thanks
Fred



Hi,

I use BDM P&E on parallel port, NoIce debugger, ICC12 compiler.

I never had that problem... until I tried to put data in absolute fixed
address. I want to put identification string in absolute area 0xff00, before
the vector area (absolute address 0xff80). It was impossible to flash
program.
I found an other solution to solve my problem (identification string set as
a const char*), and it's OK.

I use banked code too, without any problem.
The option I use in ICC12 for "S2 record type" is "CPU/Banked address".

Hope this help

Joel
-----Message d'origine-----
De: 68HC12@68HC... [mailto:68HC12@68HC...] De la part de
Real Live One
Envoy mardi 18 octobre 2005 23:00
: 68HC12@68HC...
Objet: [68HC12] IAR HCS12 Banked memory code

Hi there,

I'm using a MC9S12DP512 with a P&E USB BDM. I have problem getting
the code to the chip using Banked code model. Using the normal code
model everything is fine exept that i'm limited in size.

In banked memory mode, building goes well exept that loading the code
to the chip using debug function will generate the following fatal error:

Tue Oct 18 16:43:08 2005: Flash Programmer: Verify error when
programming at (0x408000-0x40800a).

Map file does not give any clue about something being program at
address 0x408000.

Removing the option to link library(usely set as normal), I was able
to upload the code to the chip but then the code would not work (a
simple led flashing in a while(1)) and the following error is generated:

Tue Oct 18 16:38:41 2005: Loaded debugee: U:\Debug\Exe\test iar
develeper.d12
Tue Oct 18 16:38:42 2005: Target reset
Tue Oct 18 16:38:42 2005: Driver does not support code coverage.
Tue Oct 18 16:38:42 2005: Error: Operation error.
Tue Oct 18 16:38:42 2005: Couldn't go to 'main'.

Even a manual reset does not start the program.

I'm using the default setup(no external ram, flash or anything..
simply mCPU w/clk & bdm)

Anyone has a clue what to do?

Thanks
Fred

Yahoo! Groups Links


Hi Fred,

The info from the error message tells you that the debugger is trying
to program data in the page window from 0x8000-0xbfff of the memory
map with page 0x40 selected.

Valid page numbers on the DP512 are 0x20 to 0x3f. Page 0x40 is
physically not present on your microcontroller and therefore no code
can be programmed there.

Note that page 0x3f is a special page because it appears in the page
window from 0x8000-0xbfff and also from 0xc000-0xffff in the memory
map. Perhaps the code you're trying to fit into the range from
0xc000-0xffff is larger than the 16kbyte available. The linker will
then simple located everything larger than 16kbyte in the next page,
which is the 0x40 one that isn't present.

My guess is that your debugger setup is fine and that the root of this
problem is in your linker settings. Check your linker script. This is
the *.xlc file.

-Frank
----
Feaser LLC
http://www.feaser.com - HCS12 Resources and Device Drivers
---- --- In 68HC12@68HC..., "Real Live One" <frederic.nadeau@g...>
wrote:
>
> Hi there,
>
> I'm using a MC9S12DP512 with a P&E USB BDM. I have problem getting
> the code to the chip using Banked code model. Using the normal code
> model everything is fine exept that i'm limited in size.
>
> In banked memory mode, building goes well exept that loading the code
> to the chip using debug function will generate the following fatal
error:
>
> Tue Oct 18 16:43:08 2005: Flash Programmer: Verify error when
> programming at (0x408000-0x40800a).
>
> Map file does not give any clue about something being program at
> address 0x408000.
>
> Removing the option to link library(usely set as normal), I was able
> to upload the code to the chip but then the code would not work (a
> simple led flashing in a while(1)) and the following error is generated:
>
> Tue Oct 18 16:38:41 2005: Loaded debugee: U:\Debug\Exe\test iar
> develeper.d12
> Tue Oct 18 16:38:42 2005: Target reset
> Tue Oct 18 16:38:42 2005: Driver does not support code coverage.
> Tue Oct 18 16:38:42 2005: Error: Operation error.
> Tue Oct 18 16:38:42 2005: Couldn't go to 'main'.
>
> Even a manual reset does not start the program.
>
> I'm using the default setup(no external ram, flash or anything..
> simply mCPU w/clk & bdm)
>
> Anyone has a clue what to do?
>
> Thanks
> Fred
>



Hi frank,

First thanks for your help,

I figured out that there was indeed something strange with the
message. Memory map 0x400000 does not exist that is for shure. IAR
developer (tech support actualy) gave me some modification to do on
the orignal xcl file, so the new one looks like this:
-chcs12

-D_RAM_BEGIN000
-D_RAM_ENDFFF
-D_EEPROM_BEGIN400
-D_EEPROM_ENDFFF

-D_FLASH16MID_BEGIN000
-D_FLASH16MID_ENDFFF
-D_FLASH16HI_BEGIN000
-D_FLASH16HI_ENDFFF
-D_FLASH16PAGE_BEGIN 8000
-D_FLASH16PAGE_END BFFF

-Z(CODE)INTVEC80-FFFF

-Z(CONST)DATA16_C@00-7FFF,C000-FF7F
-Z(CODE)DATA8_ID,DATA16_ID,INITTAB=_FLASH16MID_BEGIN-_FLASH16MID_END,_FLASH16HI_BEGIN-_FLASH16HI_END
-Z(CODE)DIFUNCT
-P(CODE)CODE,CHECKSUM

-D_PAGESMINUSONE1

-P(CODE)BANKED_CODE,BANKED_CODE_SEGMENT_INIT=[_FLASH16PAGE_BEGIN-_FLASH16PAGE_END]*_PAGESMINUSONE+10000
// Place banked code into logical pages

-U_FLASH16MID_BEGIN-_FLASH16MID_END>8000-3EBFFF
-U_FLASH16HI_BEGIN-_FLASH16HI_END?8000-3FBFFF

-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,HEAP+_HEAP_SIZE=_RAM_BEGIN-_RAM_END
-Z(DATA)CSTACK+_STACK_SIZE#

Well I don't see any reference to page 0x40.

If you have, or anyone, any clue about that problem, you'll be welcome
since IAR tech support doesn't have much a clue about it.

Thanks again
Fred --- In 68HC12@68HC..., "microcodefun" <voorburg@g...> wrote:
>
> Hi Fred,
>
> The info from the error message tells you that the debugger is trying
> to program data in the page window from 0x8000-0xbfff of the memory
> map with page 0x40 selected.
>
> Valid page numbers on the DP512 are 0x20 to 0x3f. Page 0x40 is
> physically not present on your microcontroller and therefore no code
> can be programmed there.
>
> Note that page 0x3f is a special page because it appears in the page
> window from 0x8000-0xbfff and also from 0xc000-0xffff in the memory
> map. Perhaps the code you're trying to fit into the range from
> 0xc000-0xffff is larger than the 16kbyte available. The linker will
> then simple located everything larger than 16kbyte in the next page,
> which is the 0x40 one that isn't present.
>
> My guess is that your debugger setup is fine and that the root of this
> problem is in your linker settings. Check your linker script. This is
> the *.xlc file.
>
> -Frank
> ----
> Feaser LLC
> http://www.feaser.com - HCS12 Resources and Device Drivers
> ---- > --- In 68HC12@68HC..., "Real Live One" <frederic.nadeau@g...>
> wrote:
> >
> > Hi there,
> >
> > I'm using a MC9S12DP512 with a P&E USB BDM. I have problem getting
> > the code to the chip using Banked code model. Using the normal code
> > model everything is fine exept that i'm limited in size.
> >
> > In banked memory mode, building goes well exept that loading the code
> > to the chip using debug function will generate the following fatal
> error:
> >
> > Tue Oct 18 16:43:08 2005: Flash Programmer: Verify error when
> > programming at (0x408000-0x40800a).
> >
> > Map file does not give any clue about something being program at
> > address 0x408000.
> >
> > Removing the option to link library(usely set as normal), I was able
> > to upload the code to the chip but then the code would not work (a
> > simple led flashing in a while(1)) and the following error is
generated:
> >
> > Tue Oct 18 16:38:41 2005: Loaded debugee: U:\Debug\Exe\test iar
> > develeper.d12
> > Tue Oct 18 16:38:42 2005: Target reset
> > Tue Oct 18 16:38:42 2005: Driver does not support code coverage.
> > Tue Oct 18 16:38:42 2005: Error: Operation error.
> > Tue Oct 18 16:38:42 2005: Couldn't go to 'main'.
> >
> > Even a manual reset does not start the program.
> >
> > I'm using the default setup(no external ram, flash or anything..
> > simply mCPU w/clk & bdm)
> >
> > Anyone has a clue what to do?
> >
> > Thanks
> > Fred
> >
>




Hi Fred,

If you still run into this problem, e-mail me the *.xlc, *.map, and
generated S-record (info@info...) and I'll have a look at it for you.

-Frank

----
Feaser LLC
http://www.feaser.com - HCS12 Resources and Device Drivers
---- --- In 68HC12@68HC..., "Real Live One" <frederic.nadeau@g...>
wrote:
>
> Hi frank,
>
> First thanks for your help,
>
> I figured out that there was indeed something strange with the
> message. Memory map 0x400000 does not exist that is for shure. IAR
> developer (tech support actualy) gave me some modification to do on
> the orignal xcl file, so the new one looks like this:
> -chcs12
>
> -D_RAM_BEGIN000
> -D_RAM_ENDFFF
> -D_EEPROM_BEGIN400
> -D_EEPROM_ENDFFF
>
> -D_FLASH16MID_BEGIN000
> -D_FLASH16MID_ENDFFF
> -D_FLASH16HI_BEGIN000
> -D_FLASH16HI_ENDFFF
> -D_FLASH16PAGE_BEGIN 8000
> -D_FLASH16PAGE_END BFFF
>
> -Z(CODE)INTVEC80-FFFF
>
> -Z(CONST)DATA16_C@00-7FFF,C000-FF7F
>
-Z(CODE)DATA8_ID,DATA16_ID,INITTAB=_FLASH16MID_BEGIN-_FLASH16MID_END,_FLASH16HI_BEGIN-_FLASH16HI_END
> -Z(CODE)DIFUNCT
> -P(CODE)CODE,CHECKSUM
>
> -D_PAGESMINUSONE1
-P(CODE)BANKED_CODE,BANKED_CODE_SEGMENT_INIT=[_FLASH16PAGE_BEGIN-_FLASH16PAGE_END]*_PAGESMINUSONE+10000
> // Place banked code into logical pages
>
> -U_FLASH16MID_BEGIN-_FLASH16MID_END>8000-3EBFFF
> -U_FLASH16HI_BEGIN-_FLASH16HI_END?8000-3FBFFF
>
> -Z(DATA)DATA16_I,DATA16_Z,DATA16_N,HEAP+_HEAP_SIZE=_RAM_BEGIN-_RAM_END
> -Z(DATA)CSTACK+_STACK_SIZE#
>
> Well I don't see any reference to page 0x40.
>
> If you have, or anyone, any clue about that problem, you'll be welcome
> since IAR tech support doesn't have much a clue about it.
>
> Thanks again
> Fred