Is it possible to re program the wixel by itself

i am thinking of an application, that may require a firmware update. meaning to update the code running. The wixel will be interfaced through serial using a wifi module. Would it be possible to write a program that can take a hex file (received via UART, and then reprogram the chip ? or is it USB the only way to do it ?



The bootloader that comes with the Wixel only supports USB. However, it would be possible to write other bootloaders on top of it. For some background on how the existing bootloader works, I recommend reading the “Wixel USB Bootloader” section of the Wixel User’s Guide.

The Wixel USB Bootloader occupies the first kilobyte (1024 bytes) and last two kilobytes of the flash, but you could make a new bootloader and have it start at address 1024. Let’s say you need 4 kilobytes for the bootloader code: then your bootloader would occupy addresses 1024 through 5119 (0x400 through 0x13FF) and the user application would take up the remaining 25 kilobytes. Since the new bootloader code is running from flash, it would not be able to update itself. Also, you would have to make a minor modification to the Wixel SDK Makefile to compile your apps for the new, smaller code space. This means that your apps would not be easily loadable through the Wixel USB Bootloader. You would want to have a way to get into the bootloader even when the application is malfunctioning, so you would probably want your WiFi module to trigger the Wixel’s RESET line.

There is another approach which might be nicer in some ways. You could write the bootloader as a Wixel library. When it is time to enter bootloader mode, the library copies some code into the Wixel’s RAM, and starts executing it from there. What you have then is a bootloader that is running from RAM, not flash. Since it is running from RAM, it can overwrite the entire 29 kilobytes of the application section of flash. The benefit of this is that the new bootloader could actually update itself, and the apps you produce can easily be loaded with either bootloader. However, there is a good chance that you would accidentally destroy the new bootloader or make it inaccessible at some point.

Either of these approaches would take a lot of work, and require you to know a lot about how the CC2511 behaves at a low level. You would also need to learn a bit of assembly and use some advanced features of SDCC.