4 Replies Latest reply on Jan 17, 2017 4:57 PM by userc_39192

    Issues with Bootloadable and Bootloader



        We are having issues adding a Fixed Stack Bootloader functionality to an existing PSoC application.


        We've been successful in running the example applications and sending updates over the air.


         We've been very unsuccessful with adding the functionality into our existing app.




         The main problem we have is after having moved the BLE component out of the BootloadABLE portion of the app, all the BLE component code we rely fails to compile.


        We have a handful of services that we handle read/write requests for by checking if the CYBLE_GATT_DB_ATTR_HANDLE_T passed from the event loop is equal to say: CYBLE_THINGIE_SERVICE_CUSTOM_CHARACTERISTIC_CHAR_HANDLE


        We've tried declaring these service handles as extern's in the ota_mandatory.h file, but compilation still fails.  Left scratching our heads as what exactly we're doing wrong.


        We're also a bit confused about what code from the existing app needs to be moved to the bootloader and what needs to stay bootloadable

        • 1. Re: Issues with Bootloadable and Bootloader



          Please have a look at the document "AN97060 - PSoC® 4 BLE and PRoC™ BLE - Over-the-Air (OTA) Device Firmware Upgrade (DFU) Guide" (Link:http://www.cypress.com/file/198301/download).





          • 2. Re: Issues with Bootloadable and Bootloader

            Hi Hima - 


            We have already reviewed the linked file.  What we are missing are details on how to make things like "CyBle_GattsReadAttributeValue" available to our bootloadable project.


            Our BLE component is defined in the Bootloader project.  The Bootloadable project is configured to require the Bootloader project per the instructions, but we are still having trouble getting our Bootloadable to compile - it seems like some of the CyBle_Gatts properties are not available.  Is this intentional?  How do we access them?



            • 3. Re: Issues with Bootloadable and Bootloader

              Some more info that might help you figure out what we're missing...


              I can get the CyBle_GattsReadAttributeValue method to be available to the bootloader (it is present in BootloaderSymbolsGcc.ld) by adjusting the build settings of the Bootloader:


              * Bootloader -> Build settings -> Linker -> Optimization -> Removed Unused sections = FALSE 


              * Bootloader -> Build Settings -> Compiler -> Optimization -> Create Function sections = FALSE


              However, when I do this, I get a strange error while building the bootloadable - that it is trying to write outside the rom area or something like that, so it fails the build step.

              • 4. Re: Issues with Bootloadable and Bootloader

                I think we've solved this one... For the missing method,


                * Add a line to bootloader's cm0gcc.ld in Scripts directory: "      KEEP(*(i.CyBle_GattsReadAttributeValue*))"


                * Added CyBle_GattsReadAttributeValue's definition to Bootloadable's ota_mandatory.h: "extern CYBLE_GATT_ERR_CODE_T CyBle_GattsReadAttributeValue
                            CYBLE_GATT_HANDLE_VALUE_PAIR_T* handleValuePair,
                            CYBLE_CONN_HANDLE_T*            connHandle,
                            uint8                           flags


                Then for the missing char handles / services,


                * Copy the #define for the service's char handle from the bootloader's generated CyBle_custom.h, and paste it into the bootloadable's ota_mandatory.h:


                #define CYBLE_SOMESERVICE_SOMETHING_CHAR_HANDLE   (0x0022u) /* Handle of something characteristic */




                For anyone else going down this path, we also ran into trouble with the bonding information - see this post for more a great description of the problem (basically you need to manage the bonding keys in the bootloader project, not the bootloadable.): http://www.cypress.com/forum/psoc-4-ble/ota-bootloader-bonding-problem