3 Replies Latest reply on Aug 10, 2017 7:41 AM by e.pratt_1639216

    Help/tips to create bootloader from scratch without Bootloadable / Bootloader components

    pieter_2521576

      Hi all,

         

      I want to port my external Adesto DataFlash bootloader from Atmel SAMD21 to a PRoC BLE (CYBLE-022001) and I had a really hard time trying to understand and use the Bootloadable and Bootloader ("Lego") building blocks. I ported the BLE_OTA_External_Memory_Bootloader to use DataFlash, got it working and finally understand how it works, but it's not what I want (for various reasons).

         

      Gripes aside, any advice to do the following would be much appreciated:

         

      1. For the app, can I remove the Bootloadable building block, but still be able to move the app to the start of a fixed address, e.g. 0x2000 to make space for the bootloader, but only for the RELEASE build? I am guessing that a GCC linker directive of "-Wl,-section-start=.text=0x2000" may work, but is there anything else that I need to do so that the app will successfully execute after the bootloader jumps to it?

         

      2. For the bootloader, can I remove the Bootloader building block, but still have an easy way of jumping to the App (at a fixed address, say 0x2000)? Inspecting the bootloader example, it looks like I need to modify CM0Start.c : Reset() to inspect the value of a 32-bit variable cyBtldrRunType stored in the .bootloaderruntype section, etc. Is there an easy way to do just this without extensive hacking? How do I override code in the Generated_Source directory?

         

      3. When jumping to the reset vector address of the App (stored at say 0x2004), when / how is the CPU told to use a vector table at this address?

         

      4. Is there a recommended API to reprogram the internal flash rows?

         

      5. Any tips / hints?

         

      Thanks in advance,

         

      Pieter