Author Topic: Bootloader for ATSAMD10  (Read 4953 times)

0 Members and 1 Guest are viewing this topic.

Offline gussabinaTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Bootloader for ATSAMD10
« on: November 23, 2016, 08:26:14 am »
Hello:

I'm looking for a Bootloader for SAMD10 and reading "Atmel AVR2054: Serial Bootloader User Guide" which provides examples for different AVR and SAMR21 parts, there are some things not very clear to me. According the Application Note, the bootloader firmware is flashed in the device, and after reset it executes and connect to a PC program to download the user application. The downloaded user application is then flashed in the device (in a higher address space in flash) and executed once this process is finished.
However, if the user application is not starting at flash address 0x00, then it should be linked to start in a different address... But there is no mention about this...I'm wondering how this really works...

I would appreciate any comment on this.
Thanks
Gus
 

Offline stfsux

  • Contributor
  • Posts: 23
  • Country: 00
Re: Bootloader for ATSAMD10
« Reply #1 on: November 23, 2016, 01:49:02 pm »
I've never used any SAM microcontroller but I will try to guess.
In most ARM cortex-M, at 0x0 from your application you will have a vector table for interruptions (generally the first DWORD is the initial stack value, then the next DWORD is the address of the RESET vector, etc.).
So you can relocate your RESET vector at a specific address but your vector table must be located at 0x0.
All this stuff is done by your linker.
The bootloader doesnt have to known where your application will be loaded, it will load the stack pointer then branch to the reset vector (by reading and replacing PC register with the value of DWORD located at 0x0+4 from application address space).
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Bootloader for ATSAMD10
« Reply #2 on: November 23, 2016, 04:18:26 pm »
AVR2054: Serial Bootloader User Guide
This is a very big bootloader designed for ZigBee stacks, it will take 1/4 of the entire flash of the device (even if it could work on D10).

You are correct, application needs to be linked after the bootloader, there is no mention of this, because it is already taken care of by the ZigBee stack. There is some other stuff that is required in that case anyway.

I have a number of very small (< 1K bootloader) bootloaders for those part, but I need to check if I can distribute them publicly.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Bootloader for ATSAMD10
« Reply #3 on: November 23, 2016, 04:19:44 pm »
your vector table must be located at 0x0.
No, the vector table can be moved in all Cortex devices, you jest need to update the SCB->VTOR register accordingly.
Alex
 
The following users thanked this post: gussabina

Offline gussabinaTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Bootloader for ATSAMD10
« Reply #4 on: November 23, 2016, 04:26:29 pm »
Hello Alex:
Thanks, it would be great if you can share a light bootloader for SAMD10, because the one I'm looking takes like 4K of flash (from the 16K available).

Thanks
Gus
 

Offline gussabinaTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Bootloader for ATSAMD10
« Reply #5 on: November 23, 2016, 04:34:05 pm »
Hello stfsux:

Thanks for your help.
Yes, agree the linker can create the image starting in any memory address (other than the default), but you need to tell the linker to do so.
My point here is that the Application Note doesn't mention that requirement, so the user would assume that a normal application would run, and I dont's think this is the case because the application would be generated to start at address 0x00, but the bootloader is already sing that space. Even when the bootloader would download the application and flash it in other memory space, it won't work because it was linked to a specific memory address space to run At least, this is my understanding.

Regards;
Gus
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: Bootloader for ATSAMD10
« Reply #6 on: November 23, 2016, 06:27:40 pm »
No, the vector table can be moved in all Cortex devices, you jest need to update the SCB->VTOR register accordingly.
In ARMv6-M devices it is optional.

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Bootloader for ATSAMD10
« Reply #7 on: November 23, 2016, 06:28:45 pm »
In ARMv6-M devices it is optional.
Yes, but I doubt there is a single device out there with this option disabled.
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Bootloader for ATSAMD10
« Reply #8 on: November 23, 2016, 06:31:03 pm »
Here is a small I2C bootloader https://dl.dropboxusercontent.com/u/6121480/work/b/bootloader.zip. I recommend this one.

Here is UART bootloader for D20, but it can be ported to D10 easily https://dl.dropboxusercontent.com/u/6121480/work/b/bootloader_uart.zip. This one is a bit more elaborate and requires image preparation by Python scripts (included).
Alex
 

Offline gussabinaTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Bootloader for ATSAMD10
« Reply #9 on: November 23, 2016, 07:51:18 pm »
Hello Alex:

Thanks for the links.
I just found this one, which seems to be for SAMD10 and UART;

http://atmel.force.com/support/articles/en_US/FAQ/Low-footprint-SERCOM-UART-bootloader-for-SAM-D10-SAM-D11-devices

I will take a look at all this material.

Thanks again
Gus
 

Offline stfsux

  • Contributor
  • Posts: 23
  • Country: 00
Re: Bootloader for ATSAMD10
« Reply #10 on: November 23, 2016, 08:32:49 pm »
No, the vector table can be moved in all Cortex devices, you jest need to update the SCB->VTOR register accordingly.

Sure but in that case your bootloader need to change it and should mention it somewhere. Otherwise, I guess we have the default configuration.

I dont's think this is the case because the application would be generated to start at address 0x00, but the bootloader is already sing that space.
Ye, after a quick look (http://www.atmel.com/Images/Atmel-42366-SAM-BA-Bootloader-for-SAM-D21_ApplicationNote_AT07175.pdf) you're right.
So that mean you have to dig some doc about that pre-programmed bootloader and check where you need to locate your application program.
glhf
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Bootloader for ATSAMD10
« Reply #11 on: November 23, 2016, 09:00:11 pm »
Sure but in that case your bootloader need to change it and should mention it somewhere. Otherwise, I guess we have the default configuration.
No, this must be done by the application, since only application knows how it is linked. I often have applications run from RAM, so beginning of the application (wherever it is located) only contains two values - initial stack pointer and reset vector. The rest of the table is in RAM.

So that mean you have to dig some doc about that pre-programmed bootloader and check where you need to locate your application program.
Those devices don't come with a bootloader. Only CSP packages have pre-programmed bootloader and that is documented, but it is 4K in size.
Alex
 

Offline Skerved

  • Contributor
  • Posts: 12
  • Country: se
Re: Bootloader for ATSAMD10
« Reply #12 on: May 31, 2017, 11:23:04 am »
ataradov, is there a chance you could make that I2C bootloader available again? I have been looking for a simple non asf version that I can build upon.

As a lurker, thanks for all your help with SAMDXX coding!
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11236
  • Country: us
    • Personal site
Re: Bootloader for ATSAMD10
« Reply #13 on: May 31, 2017, 04:04:23 pm »
Alex
 
The following users thanked this post: Skerved


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf