XMega bootloader – How to make use of the functions in assembly source file

assemblyatmel-studioatxmegaavrbootloader

Its been two days I'm trying to write a Bootloader for ATXMega32E5. The Atmel studio doesn't have boot.h header file supporting XMega.

As a result of searching and googling, I found two ASM header sp_driver.S and sp_driver.h. Even after the two readings and trial, I couldn't find how to use that asm functions in the embedded C code.

If someone came across this way, do help me in creating a bootloader. Or to create a makefile linking the source and header with the C file. That way I can call the functions and I will make my own bootloader

Best Answer

The functions in the assembly file are just like any C functions that get linked by AVR-GCC when you include the sp_driver.S and sp_driver.h files and call those functions from your bootloader code. For instance, put this in your main code's header file:

#include "sp_driver.h"

and then call any of the functions from sp_driver, e.g.

SP_EraseApplicationPage(Address); SP_WaitForSPM();

Make sure the sp_driver.S is included in the compile list so the compiler and linker can find it.

Related Topic