Main Site Documentation

Application with managed bootloader deployment


#1

First of all thanks guys for taking bootloader problem out of our shoulders :slight_smile: I work with some ANSI-C low level 8-bit developers were always afraid of this subject. Since 8-bit microcontrollers are becoming more expensive than 32-bit I managed to show my employeer that using .NET Micro Framework would speed up projects using benefits like this one :slight_smile:

Could anyone point me in the right direction regarding deployment of devices with application and bootloader on board ? This is how I understand the concept (please correct me if I’m wrong):

[ol]

  1. I have two managed applications: Main app, Bootloader app

  2. Main app looks up (e.g. on the Internet) for new version of software and when one is detected, application switches to bootloader mode

  3. Bootloader app downloads the new version, validates it, updates the main application and switches back to it application mode
    [/ol]

This is of course a case when only managed application is updated, not entire firmware. My questions/doubts:

[ol]

  1. Having a just-shipped-in device how can I upload both application and bootloader?

  2. Can I generate the main application .hex file other way than deploying it to device and downloading it back?

  3. Can I update my bootloader in this process or do I have to make sure no changes will be needed?
    [/ol]


#2

You shouldn’t need to worry about the bootloader, only your app.

.net runs the CLR, which will in turn, run your application. As far as updates. GHI notify’s all users of any pending updates… then instructs user’s on how and when to update the firmware.

It’s very transparent leaving you to concentrate on making yourself look brilliant.

You code your application in C# on a free version of VS2010 then deploy to the FEZ by USB.

If your firmware ( I think thats what you mean when you say bootloader ) is out of date watch this video clip and your away…
http://www.youtube.com/watch?v=Y4Va_tPqqpg new version is 4.1.3.0

Very simple

Cheers Ian


#3

GHI also allows you to write boot loader in c# if you like but this is optional


#4

@ IanR You misunderstood my problem. I’m thinking about something called IN-FIELD UPDATE. You can read about it more in EMX documentation and under this address:

http://www.ghielectronics.com/downloads/NETMF_Beta/Library%20Documentation/html/53c9fe92-8150-bd36-e2de-bf4fc6f13f8f.htm

Imagine this situation. My device is running at customer site. Im not able to connect to device. The device will be connected to Ethernet and can check for updates under predefined Internet address. This is why Im asking about the bootloader and I mean the C# managed version I can create. By firmware I mean what is delivered by GHI. Please having this in mind look once more on my questions.


#5

[quote]1. Having a just-shipped-in device how can I upload both application and bootloader?
[/quote]
You have to Enable boot loader mode then
download the bootloader and firmware. It is up to you how you will switch between the two.

[quote]2. Can I generate the main application .hex file other way than deploying it to device and downloading it back?
[/quote]
It can only be done as described in the documentation.

[quote]3. Can I update my bootloader in this process or do I have to make sure no changes will be needed?
[/quote]
No. The purpose of this is that the bootloader is fixed!
If you need to update the bootloader, you need complete update option.


#6

Thanks Mike. It is clear for me that my bootloader needs to be fixed, just wanted to make sure. I’m exploring the possibilities of using continuous integration and automatic deployment. Until building solution this is the same as for regular .NET applications. Building hex file however will require hardware presence. I can imagine one EMX board connected to CI server that could be used for deploying the application and downloading the hex file (all using mfdeploy). After that the hex file could be uploaded to a remote location from which devices could download it over the Internet. Any comments on this process ?

Also could someone propose step-by-step how to deploy application with bootloader to a just-shipped-in device so that a process for production could be specified ?


#7

[quote] I can imagine one EMX board connected to CI server that could be used for deploying the application and downloading the hex file (all using mfdeploy). After that the hex file could be uploaded to a remote location from which devices could download it over the Internet. Any comments on this process ?
[/quote]
I am not exaclty sure what you mean, but you must develop your application on an EMX board with changes…etc. You have to downlod it and test it… When all done, you can read it through MFDeploy and put on your server.

[quote]Also could someone propose step-by-step how to deploy application with bootloader to a just-shipped-in device so that a process for production could be specified ?
[/quote]

  1. Enable Bootloader mode.
  2. Switch to bootloader mode because you are in application mode by default.
  3. Download the bootloader.hex which will update the application.hex and run it.

#8

Programmer is developing a new feature in the application. Each time he commits his changes the build server compiles his code and notifies all team members if a build is broken. The developer/tester can localy upload the application to his EMX board and test the new feature. If feature passes functional tests project manager can hit DEPLOY. Continuous integration server will deploy the compiled application to EMX board, download hex file and send it to remote location for discovery. Thats why the CI server needs one EMX board connected - in order to create the application hex file.


#9

I’m not sure if i’m doing the last step correctly.

  1. Bootloader is enabled and device is erased
  2. Deploy application when device is in application mode.
  3. Application does not detect SD card -> hello world is displayed
  4. Use mfdeploy to ‘Create Application Deployment’ hex file.
  5. Save hex file to SD card.
  6. Plug SD card into device slot
  7. Restart device
  8. Application detects SD card and switches to bootloader deployment mode
  9. Deploy bootloader application
  10. Bootloader application reads hex file from SD card and updates main application
  11. Bootloader switches to application deployment mode

And now nothing happens. MFdeploy output:

Ready.
Cannot find any entrypoint!
Done.
Waiting for debug commands…


#10

I am not sure.
Do you have an LCD, so you can see output?
Put checks at the start of your program to make sure you are in the correct mode (application vs bootloader)


#11

Yes, I’m using Cobra board. I determine the current mode by reading the information available on LCD during startup. Sometimes I also use Pizo as checkpoints rather than display.

If I download application .hex file, erase my device and deploy the hex back (all using mfdeploy) the same situation occurs…


#12

Probably you are missing some steps or doing something wrong. Follow the example in the documentation. It should work fine…


#13

Here is how I use MFDeploy to read application hex file and write it back. I assume this approach is wrong since it’s not working :slight_smile:

http://www.youtube.com/watch?v=BpENlCPe-wU


#14

I suspect you have incompatible versions of TinyBooter and firmware. What version is your TinyBooter and firmware? Look at the LCD, it says Timy Booter mode version xxx when it is in TinyBooter mode. Firmware you can see it on LCD or device capabilities.
If you are not sure what’s going on, erase your entire board and update TinyBooter and firmware with latest SDK.
Also, try making the “create application deployment” with a key.


#15

Indeed! I had firmware 4.1.3 and TinyBooter 4.1.1. After upgrading TinyBooter to everything described earlier works like a charm :slight_smile: Thank you Mike, I would buy you a beer if it wasn’t for the distance :confused:


#16

Mike, do you want to go to Poland? :smiley: Graling is buying us beer :wink:

By the way, Mike is single so maybe we can hook him up with miss Poland http://www.whoateallthepies.tv/Miss%20Poland.jpg

…I am kidding of course. We are glad ti worked for you


#17

It’s true that polish girls are among most beautiful in Europe but may that not fool you:

Still it’s nice to see them everyday ;D


#18

I’m booking my flight right now :smiley: