[riot-notifications] [RIOT-OS/RIOT] Add Riotboot support for CC2538 (#11665)

Francisco notifications at github.com
Wed Jun 19 11:22:43 CEST 2019


@brent7984 I got it too work in a hacky way. I followed the same procedure as you and got the same results. I had two problems which I think explain why it was working with "cc2538-bsl.py", but once fixed it managed to make it work.

1.- Since you removed `-e` flag (which is needed since everything doesn't get wiped out) the flash only succeeds the first time (when the targeted bytes are still 0xFF). But on the second time it doesn't actually write to flash since the bytes need to be in an erase state to write to them.

In the `cc2538-bsl.py` I added this lines just after `def writeMemory(self, addr, data):`

```
        mdebug(5, "Erasing %s bytes starting at address 0x%08X"
               % (len(data), addr))
        self.cmdEraseMemory(addr, len(data))
```

So this solved the problem of writing to flash. But weirdly I was still booting allways from the same slot.

2.- The second problem comes from the cca array.

```
const uint32_t cca[] = {
    /* Bootloader Backdoor Configuration: */
    0xe0ffffff | (CCA_BACKDOOR_ENABLE << 28) | (CCA_BACKDOOR_ACTIVE_LEVEL << 27) | (CCA_BACKDOOR_PORT_A_PIN << 24),
    0x00000000,                     /**< Image Valid */
    (uint32_t)&cortex_vector_base,  /**< Application Entry Point */

    /* Unlock all pages and debug: */
    0xffffffff,
    0xffffffff,
    0xffffffff,
    0xffffffff,
    0xffffffff,
    0xffffffff,
    0xffffffff,
    0xffffffff,
};
```

You can see the entry point to the application is also defined here, so depending when you deleted the `cca` region the entry point will always be the same. In my case I had flashed `combined-slot0` and the entry point was `slot0` and not the bootloader so it was always booting from slot0 because it was skipping the bootloader. If i flashed bootlaoder first `riotboot/flash-bootloader` then deleted `cca` and proceeded to alternatively flash each region it worked!

Ok so the `cca` is still hacky, but I think we are slowly progressing (assuming this also works for you :) )

Can you try these changes? Do you think these problems can apply to what you are doing? I will try to pr the `cc2538-bsl.py` changes upstream so it support partial erase.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11665#issuecomment-503480875
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190619/c624df8d/attachment.html>


More information about the notifications mailing list