How to set linker options for boot loader build?

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

I want to migrate xboot from a makefile project to a S6 project. I've created a new project, removed the files the wizard created and added the files from my existing project. I want to set the project options to match my makefile options. How do I set the .text address. I tried to cut and paste the option line from the makefile into the project linker settings, but I haven't got the syntax right.

Attachment(s): 

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

If I remember correctly, it's just "NAME=0xABCD", the other parts are automatically added.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Personally I'm a luddite and don't trust IDEs so the way I've done this is simply to go to "Miscellaneous settings" and enter that very same -W,-section... command there. The Miscellaneous does nothing more than tag what you type onto the linker invocation. By the way:

-Wl,-Ttext=0x1234

is a shortened form way to say:

-Wl,-section-start=.text=0x1234

If you do want to use "Memory Settings" then as Dean says:

.text=0x1234

Under "Flash" is all you need and the IDE wraps this in a section-start directive:

		Invoking: AVR/GNU Linker : (AVR_8_bit_GNU_Toolchain_3.4.0_663) 4.6.2
		"C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-gcc.exe" -o GccApplication1.elf  GccApplication1.o   -Wl,-Map="GccApplication1.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,-section-start=.text=0x2468   -mmcu=atxmega128a1  

Note I entered 0x1234 and it passed 0x2468 so it's doing a Word to Byte translation for you (one of the reasons I don't like IDE's "getting in the way"!)

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

Hello

I am trying to create a boot loader application in the AVR Studio 5.1.208 for atmega128.

How can I set up correctly the AVR Studio 5 to recognize this is a boot loader.

At the AVR/GNU C++ Linker Memory Settings I inserted the .text=0xf000.

I found out two major problems.

1.) If I have the Release configuration selected then the output file is correctly linked. Then I start to debug using avr simulator and the starting address is 0x00000 not the 0xF000(0x1E000).

2). Under Debug configuration the generated output file is not correct. It is linked to address 0x00000.
I have the same settings like in Release configuration.
Checked the Linker options and they are the same.

It seems that the AVR studio 5.1 does not work ok with atmega128
Please help.

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

Update to Studio 6.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Is there any way to make Studio 6 create .bin output files rather than (or in addition to) .hex format files? The Configuration manager->Toolchain->AVR/GNU Common->Output file page has check boxes for .hex, .lss, and .eep, but no .bin.

I want a .bin image to write onto USB thumb drives for bootloading an embedded xmega256A3U device via the drive. I can certainly use the .hex format but it's at least twice as large, and with the 'VDRIVE 2' usb module, the data transfer is painfully slow. Not to mention I will need an Intel-hex parser in the bootloader file.

Alternatively I could use an external utility (hex2bin??) but that's yet another step in the compile-debug cycle that could be avoided if I just start with the desired .bin file.

Thanks,
Harry

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

You need to use the avr-objcopy utility, included in WinAVR and the Atmel Toolchain:

avr-objcopy -I ihex -O binary InputFile.hex OutputFile.bin

Note that you could do this from the generated ELF if you use an external makefile, but the internal one in AS4 cannot be modified to produce a BIN file.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Dear abcminiuser

 

I am using as6 made a atemga128 boot loader, its accepting hexcode from uart but not writing into the flash. Please help. Below is my code

I have defined .text=0x1FC00

 

        if(type==0)
                        {
                            while (count<SPM_PAGESIZE)
                            memory[count++]=0xff;
                            
                            for(i=0; i<SPM_PAGESIZE; i+=2)
                            {
                                      boot_page_fill(address1+i, memory[i+1]<<8|memory[i]);
           
                            }
                            boot_page_write(address1);            //Write to Flash
                            boot_spm_busy_wait();
                            boot_rww_enable();
                        }

 

 

Thanks

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

Please don't cross post - I already answered your identical post elsewhere.