Skip to content

Add support for updating sketches from an SD card #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 2, 2017

Conversation

sandeepmistry
Copy link
Contributor

Via 2nd stage boot code that checks SD card for UPDATE.bin.

Also, added tool info to platform.txt to update sketches via HTTP outside the core for later.

cc/ @cmaglie @facchinm @agdl @akash73

@tuxedo0801
Copy link
Contributor

tuxedo0801 commented Jan 16, 2017

Is there some kind of documentation on how to use this? Just copy the update.bin to sd-card and reboot arduino zero with the ota sketch?

Would this be possible with SPI flash as well? Is there some special boot-loader required?

[update]
I see, it's not just a sketch, i's a kind of "addon" to the boot-loader?!
A short documentation on how to use this (step-by-step procedure) would be great. Waiting for this soooo long (but want to use SPI flash instead of SD ...)

@@ -67,6 +67,9 @@ SECTIONS
{
__text_start__ = .;

KEEP(*(.ota_boot))

. = ALIGN(256);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd align the .ota_boot section to either 0x2000 or 0x4000 to make sure that the reset vector does not get relocated to something different than 0x6000 if the 2nd stage bootloader becomes slightly smaller

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it to 0x2000.

Maybe we can have a clearer name for this section second_stage, second_stage_boot or sketch_boot?

@tuxedo0801
Copy link
Contributor

ping

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b137_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Add support for updating sketches from an SD card #203
  5. Select one of the boards under SAMD Pull Request Add support for updating sketches from an SD card #203 in Tools->Board menu
  6. Compile/Upload as usual

@cmaglie
Copy link
Member

cmaglie commented Jan 19, 2017

@tuxedo0801
you must patient a bit, this is still experimental, we'll provide documentation once ready.

@tuxedo0801
Copy link
Contributor

@cmaglie thanks for first feedback.
I don't want the complete documentation. Just let me know if this would be tied to sd cards or if it will be possible with SPI flash as well (or maybe it's up to the user?!).

That would help me continuing my development into the right direction...

@cmaglie
Copy link
Member

cmaglie commented Jan 19, 2017

For now it's SD card only.

@dlabun
Copy link

dlabun commented Jan 19, 2017

Out of curiosity, is this going to replace the default boot loader or run in tandem with it?

@sandeepmistry
Copy link
Contributor Author

@dlabun good question! It will run in tandem.

@tuxedo0801
Copy link
Contributor

To give you an insight in why I want to use SPI flash instead of SD card:

I'm developing small devices for KNX home automation bus. The devices are totally bus-powered. And the KNX transceiver chip allows max ~50mA to be drawn from KNX bus. So it's very low power.

SD cards consume too much energy to be powered from KNX bus. SPI flash consumes almost nothing, compared to SD card. And even micro-sd card socket is much bigger than a small SPI flash package... Size matters ;-)

As the SPI flash is not pluggable like SD card, the new sketch is received directly from KNX bus. So updating a device is just a simple click on the control-application on a PC that is also connected to bus. File is transferred over bus and stored into SPI flash.

I guess there are more people out there that wand to read the firmware from somewhere else than a pluggable SD card (get via ethernet, wifi, some radio module, power line, ... whatever and stored on any storage).

I would be glad if you foresee a user-friendly mechanism that allows the sketch-writer to speficy an own storage mechanism to read the update from, that don't requires fiddling with core classes and modifying the samd core.

Beside my whishes: Tumbs up for this new feature... Keep up the good work.

@deladriere
Copy link

deladriere commented Jan 31, 2017

what CS pin are you using ? (mine is pin 10)

I can't have the bootloader to boot from the SD
Here is what I did

  1. installed as instructed
  2. burned the bootloader with Atmel SAM-ICE programmer
  3. compiled Blink example and renamed the .bin to UPDATE.bin
  4. copied the UPDATE.bin to sd
  5. reseted the board

but it stays in booloader mode with the led glowing
Am i missing something ?

@deladriere
Copy link

Sorry to insist : I can't figure how to get started
thanks !

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b142_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Add support for updating sketches from an SD card #203
  5. Select one of the boards under SAMD Pull Request Add support for updating sketches from an SD card #203 in Tools->Board menu
  6. Compile/Upload as usual

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b143_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Add support for updating sketches from an SD card #203
  5. Select one of the boards under SAMD Pull Request Add support for updating sketches from an SD card #203 in Tools->Board menu
  6. Compile/Upload as usual

@deladriere
Copy link

deladriere commented Mar 1, 2017

Where do you set the CS pin to use ?
No need to install a special Bootloader ?
I installed b-143 as instructed buy cannot compile any sketch (Board arduino_zero_edbg (platform samd, package arduino-beta) is unknown)

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b144_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Add support for updating sketches from an SD card #203
  5. Select one of the boards under SAMD Pull Request Add support for updating sketches from an SD card #203 in Tools->Board menu
  6. Compile/Upload as usual

@agdl
Copy link
Member

agdl commented Mar 2, 2017

Tested. LGTM

@agdl agdl merged commit 91bee1d into arduino:master Mar 2, 2017
@deladriere
Copy link

@agdl How do you set the CS pin ?

@tuxedo0801
Copy link
Contributor

@cmaglie

you must patient a bit, this is still experimental, we'll provide documentation once ready.

It has been merged into master about three weeks ago. So it's ready now?

Questions so far:

  • How do I enable this feature? Just include the "SDU" lib in my sketch?
  • Is it possible to use alternative pins for accessing sd-card? If yes, how?
  • Is it somehow foreseen to easily use an alternative "SDUBoot.ino" implementation? (like using an SPI flash chip instead of a SD card)

@tuxedo0801
Copy link
Contributor

For anyone searching the same information: #220

@tuxedo0801 tuxedo0801 mentioned this pull request Mar 24, 2017
@cmaglie cmaglie deleted the ota branch July 11, 2017 12:41
@cmaglie cmaglie added this to the Release 1.6.19 milestone Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants