Reset Vector opcodes different between AS6 and AS7

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

Changing from Studio  6.2 to Studio 7 ( Windows 7 64 bit )

 

Whilst using Studio 7, the reset vector opcodes codes are :

 

0000000  5C C0  RJMP PC+0x005D

 

 

But when compiled with Studio 6.2

 

0000000  55 C0  RJMP PC+0x0056

 

Both compiled programs work ok, but there is a bootloader which expects to see the 0x55 at address 00000 as generated by AS6.2

 

CPU is AVR XMEGA32E5

 

Why would I get different reset vectors?  It would seem that the C Startup code needs a different start address, but why would it do this?

Do AS6 and AS7 use  different compilers? Both are set to usi AVR GNU Tools, and I assume they are a common toolset in my system for both Studio versions.

Any information / help appreciated.

 

Ideally I would like Studio 7 to generate the same opcode jump.

This topic has a solution.
Last Edited: Thu. Jul 14, 2016 - 02:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a question of whether the -mrelax switch is used. It tells the compiler to replace long JMP and CALL with the shorter RJMP and RCALL when it can. In most places this tightens up the code to use less flash.

PS looking for specific opcodes is never a great strategy. Far better to have the bootloader calculate and check a CRC.

Last Edited: Thu. Jul 14, 2016 - 07:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, you're right but there's only bytes left in bootloader space. I'll need to deal with the check somehow.

 

I'll check the switch option you mentioned , but since both are already using the RJMP I can't see that being relevant here.

I have just spotted that they do actually use different compilers.

AS6

C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\avr\include
C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\lib\gcc\avr\4.7.2\include
C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\lib\gcc\avr\4.7.2\include-fixed

 

AS7

C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include
C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include
C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\4.9.2\include-fixed

 

I feel I've seen a drop down selection somewhere a while ago that specified GCC or Native ..  but can't spot that right now. ( where is it? ) That may help.

 

EDIT Found it .. but both set to Native.... 

 

 

 

 

Last Edited: Thu. Jul 14, 2016 - 08:32 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well if the older toolchain is still there on the same PC set up "toolchain flavours" and point it to the 4.7.2 instead of the 4.9.2

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

Thanks , Yes I've just done that. Added a new flavour, using the AS6 toolchain.

The output hex file appears as I need it now.

 

Very good :)