Author Topic: Overflow in .flash1 using _ENCRYPTED  (Read 15541 times)

Offline ewan

  • Newbie
  • *
  • Posts: 43
    • View Profile
Overflow in .flash1 using _ENCRYPTED
« on: December 01, 2008, 06:34:46 PM »
I have the boot loader working fine with my SPI chip. I decided to try out the encryption but I get the linker message "Overflow in segment: flash1 from section: .flash1 Segment reserved size is 0x0400 -- Overflow of: 0x0050". Is there something I need to take out or move to another module?

Thanks,
Ewan.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3243
    • View Profile
    • uTasker
Re: Overflow in .flash1 using _ENCRYPTED
« Reply #1 on: December 01, 2008, 08:38:07 PM »
Hi Ewan

I just tested using CW7.1 with internal and SPI FLASH, with and without encryption and I didn't get any linker errors.
Check that you are compiling with parameter passing set to "Register" since this keeps the code size down. Also ensure that you have optimisation as high as possible - optimised for code size. The only way that I could force this error was by setting everything to the worst settings - then there were 80 bytes too many to fit.

Have you added code to mcf5223X_boot.s or uTaskerBootLoader.c? These are the two which need to fit into the first 0x400 bytes.
Below is my reference MAP of this block when set up for SPI FLASH with encryption:

Code: [Select]
# .flash1
  00000000 000000AC .text   .text (mcf5223X_boot.s)
  00000000 00000000 .text   VECTOR_TABLE (mcf5223X_boot.s)
  00000000 00000000 .text   VECTOR_TABLE (mcf5223X_boot.s)
  00000008 00000000 .text   asm_startmeup (mcf5223X_boot.s)
  00000008 00000000 .text   start (mcf5223X_boot.s)
  00000008 00000000 .text   asm_startmeup (mcf5223X_boot.s)
  00000008 000000A4 .text   @DummyFn1 (mcf5223X_boot.s)
  00000062 00000000 .text   asm_int_off (mcf5223X_boot.s)
  00000062 00000000 .text   asm_int_off (mcf5223X_boot.s)
  00000080 00000000 .text   asm_int_on (mcf5223X_boot.s)
  00000080 00000000 .text   asm_int_on (mcf5223X_boot.s)
  0000009E 00000000 .text   mcf5xxx_wr_vbr (mcf5223X_boot.s)
  000000AC 0000005A .text   uTaskerBoot (uTaskerBootLoader.c)
  00000106 000000BC .text   fnCheckNewCode (uTaskerBootLoader.c)
  000001C2 00000072 .text   fnDecrypt (uTaskerBootLoader.c)
  00000234 000000F0 .text   fnCopyNewCode (uTaskerBootLoader.c)
  00000324 0000007E .text   fnCheckCopiedCode (uTaskerBootLoader.c)
  000003A2 0000002E .text   fnDeleteCodeCopy (uTaskerBootLoader.c)
  000003D0 00000006 .rodata ucKey (uTaskerBootLoader.c)
  000003D6 0000000A .rodata ucDecrypt (uTaskerBootLoader.c)
#>000003E0          ___DATA_ROM (linker command file)

# .flashconfig
  00000400 00000000 .text   FLASH_CONFIG (flash_config.s)
  00000400 00000000 .text   FLASH_CONFIG (flash_config.s)
  00000400 00000018 .text   .text (flash_config.s)


If you are using CW7.0 (which did produce larger code) try upgrading to CW7.1.

Regards

Mark

Offline ewan

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Overflow in .flash1 using _ENCRYPTED
« Reply #2 on: December 01, 2008, 09:41:19 PM »
Mark,

I had not added extra code. It was the optimization. The encryption works well.

Many thanks once again,
Ewan.