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


1 Answer 1


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.

  • \$\begingroup\$ How can i add it in the compiler list? I am using atmel studio. Thats what i am searching.. Couldn't find it anywhere. \$\endgroup\$
    – gzix
    Oct 27, 2014 at 15:23
  • 1
    \$\begingroup\$ First, make sure you have sp_driver.h and sp_driver.S somewhere in your project folder or some subfolder. Then make sure the Solution Explorer is visible (View->Solution Explorer). Click on the button 'View all files' at the top of the solution explorer window. You should now be able to navigate to the sp_driver files. Right click and select 'Include in project'. That's it. \$\endgroup\$
    – user36129
    Oct 27, 2014 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.