how to modify makefile to fix UC3B0512 flash reset addr bug?

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

Hi,

I'm waiting for the UC3B0512 and I saw that it has the reset vector at 0x80000020 instead of 0x80000000;

So I wonder how to change my makefile to fix this bug?

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

I just tried this:

# Flash memories: [{cfi|internal}@address,size]...
FLASH = internal@0x80000020,512Kb

but the compiled code still starts from 0x80000000.

so how to fix it?

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

Use the linker script from the Newlib and set the partnumber to uc3b0512revc.
I heard revD is coming soon (April)

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
# Linker script file if any
LINKER_SCRIPT = $(UTIL_PATH)/LINKER_SCRIPTS/AT32UC3B/0512/GCC/link_uc3b0512.lds

this is what I tried before.

So what is the path to Newlib uc3b0512revc then?

will revD fix this FLASH issue?

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

This SF linker script (in(UTIL_PATH)/LINKER_SCRIPTS/AT32UC3B/0512/GCC/link_uc3b0512.lds ) does not contain the workaround. You can however use this linker if you use this special B0512revC trampoline (which will be linked at 0x8000 0000) and does contain the workaround:

\SERVICES\USB\CLASS\DFU\EXAMPLES\ISP\AT32UC3B0512_REVC\boot.S

Newlib linker script is there:
\Program Files\Atmel\AVR Tools\AVR32 Toolchain\avr32\lib\ldscripts\avr32elf_uc3b0512revc.x

-sma

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

ok, thanks.
I copied the fix into the trampoline I use:

//! @{
//! \verbatim


  // This must be linked @ 0x80000000 if it is to be run upon reset.
  .section  .reset, "ax", @progbits


  .global _trampoline
  .type _trampoline, @function
_trampoline:
  // Workaround for AT32UC3B0512 revC - reset vector is 80000020h rather than 80000000h. Flash gap needs to be programmed with 00000000h.
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  add r0, r0
  // Jump to program start.
  rjmp    program_start

  .org  PROGRAM_START_OFFSET
program_start:
  // Jump to the C runtime startup routine.
  lda.w   pc, _stext


//! \endverbatim
//! @}

now I think this should be no problem for UC3B0256 also.

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

Yes it will work for the other parts too.

-sma