3 Replies Latest reply on Sep 24, 2020 6:15 AM by GaneshD_41

    Problem Compiling project with Bluetooth DFU

    MuNa_4652896

      Hello

       

      I am compiling a project that incorporates DFU via Bluetooth. The Project compiles successfully with no problems at all. Now, I am merging this project with the original project I am working on, however I am getting this error while merging those files

      dfu_mdk_common.h and dfu_mdk_symbols.c

       

      arm-none-eabi-gcc.exe -mcpu=cortex-m0plus -mthumb -I. -IGenerated_Source\PSoC6 -IGenerated_Source\PSoC6\pdl\cmsis/include/ -IGenerated_Source\PSoC6\pdl\devices/psoc6/include/ -IGenerated_Source\PSoC6\pdl\devices/psoc6/include/ip/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/device/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/efuse/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/flash/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/gpio/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/ipc/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/lvd/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/profile/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/prot/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/scb/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/sysanalog/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/sysclk/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/sysint/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/syslib/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/syspm/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/systick/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/tcpwm/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/trigmux/ -IGenerated_Source\PSoC6\pdl\drivers/peripheral/wdt/ -IGenerated_Source\PSoC6\pdl\middleware/ -IGenerated_Source\PSoC6\pdl\middleware/em_eeprom/ -IGenerated_Source\PSoC6\pdl\utilities/ -Wa,-alh=.\CortexM0p\ARM_GCC_541\Debug/dfu_mdk_symbols.lst -g -D DEBUG -D CY_CORE_ID=0 -D CY_PSOC_CREATOR_USED=1 -D CYBLE_416045_02 -Wall -ffunction-sections -ffat-lto-objects -Og -c dfu_mdk_symbols.c -o .\CortexM0p\ARM_GCC_541\Debug\dfu_mdk_symbols.o

      dfu_mdk_symbols.c:29:7: error: expected '(' before 'void'

      __asm void cy_DFU_mdkAsmDummy(void)

       

      How to solve this problem?

       

      Thank you

       

       

      EDIT: I am having an overlapping problem now

       

      .\CortexM4\ARM_GCC_541\Debug\App1_merged.elf.tmp: Merge error: section at 0x100FFA00 from .\CortexM4\ARM_GCC_541\Debug\App0.elf overlaps section at 100FFA78 from .\CortexM4\ARM_GCC_541\Debug\App1.elf

      The command 'post_build_core1.bat' failed with exit code '1'.

       

      dfu_cm0p.Id for Both App0 and App1

          flash_app0_core0  (rx)  : ORIGIN = 0x10000000, LENGTH = 0x40000

          flash_app0_core1  (rx)  : ORIGIN = 0x10040000, LENGTH = 0x40000

          flash_app1_core0  (rx)  : ORIGIN = 0x10090000, LENGTH = 0x40000

          flash_app1_core1  (rx)  : ORIGIN = 0x100D0000, LENGTH = 0x40000

       

           em_eeprom         (rx)  : ORIGIN = 0x14000000, LENGTH = 0x4000

       

           flash_storage     (rw)  : ORIGIN = 0x100C0000, LENGTH = 0x1000

           flash_boot_meta   (rw)  : ORIGIN = 0x100FFA00, LENGTH = 0x400

       

      dfu_cm4.Id for Both App0 and App1

          flash_app0_core0  (rx)  : ORIGIN = 0x10000000, LENGTH = 0x40000

          flash_app0_core1  (rx)  : ORIGIN = 0x10040000, LENGTH = 0x40000

          flash_app1_core0  (rx)  : ORIGIN = 0x10090000, LENGTH = 0x40000

          flash_app1_core1  (rx)  : ORIGIN = 0x100D0000, LENGTH = 0x40000

       

           em_eeprom         (rx)  : ORIGIN = 0x14004000, LENGTH = 0x4000

       

           flash_storage     (rw)  : ORIGIN = 0x100C0000, LENGTH = 0x1000

          flash_boot_meta   (rw)  : ORIGIN = 0x100FFA00, LENGTH = 0x400

       

      The project includes BLE and EEPROM too. It was already working, but with different LENGTHs

        • 1. Re: Problem Compiling project with Bluetooth DFU
          RavikiranH_01

          HI MuNa_4652896,

           

          Which compiler you are using ? .ld files will be used only for GCC. Are you using GCC ?
          If you are using GCC, probably one of your application is overflowing the allocated regions. Please can you take a look ? 

           

           

          Thanks

          • 2. Re: Problem Compiling project with Bluetooth DFU
            MuNa_4652896

            Sorry for the late replies.

            I am using GCC Compiler. I have modified the above *.ld files as well as dfu_mdk_common.h with the following

             

            All *.ld files

                flash_app0_core0  (rx)  : ORIGIN = 0x10000000, LENGTH = 0x10000

                flash_app0_core1  (rx)  : ORIGIN = 0x10010000, LENGTH = 0x30000

                flash_app1_core0  (rx)  : ORIGIN = 0x10040000, LENGTH = 0x20000

                flash_app1_core1  (rx)  : ORIGIN = 0x10060000, LENGTH = 0x60000

             

             

                flash_storage     (rw)  : ORIGIN = 0x100C0000, LENGTH = 0x1000

                flash_boot_meta   (rw)  : ORIGIN = 0x100FFA00, LENGTH = 0x400

             

             

                sflash_user_data  (rx)  : ORIGIN = 0x16000800, LENGTH = 0x800

                sflash_nar        (rx)  : ORIGIN = 0x16001A00, LENGTH = 0x200

                sflash_public_key (rx)  : ORIGIN = 0x16005A00, LENGTH = 0xC00

                sflash_toc_2      (rx)  : ORIGIN = 0x16007C00, LENGTH = 0x400

             

             

                efuse             (r)   : ORIGIN = 0x90700000, LENGTH = 0x100000

             

             

                ram_common        (rwx) : ORIGIN = 0x08000000, LENGTH = 0x0100

               

               

                /* note: all the ram_appX_core0 regions has to be 0x100 aligned */

                /* and the ram_appX_core1 regions has to be 0x400 aligned       */

                /* as they contain Interrupt Vector Table Remapped at the start */

                ram_app0_core0    (rwx) : ORIGIN = 0x08000100, LENGTH = 0x7F00

                ram_app0_core1    (rwx) : ORIGIN = 0x08008000, LENGTH = 0x8000

             

             

                ram_app1_core0    (rwx) : ORIGIN = 0x08000100, LENGTH = 0x7F00

                ram_app1_core1    (rwx) : ORIGIN = 0x08008000, LENGTH = 0x8000

             

             

                em_eeprom         (rx)  : ORIGIN = 0x14000000, LENGTH = 0x4000

                xip               (rx)  : ORIGIN = 0x18000000, LENGTH = 0x08000000

             

            dfu_mdk_common.h

             

            /* Memory region ranges per core and app */

            #define CY_APP0_CORE0_FLASH_ADDR        0x10000000

            #define CY_APP0_CORE0_FLASH_LENGTH      0x10000

             

             

            #define CY_APP0_CORE1_FLASH_ADDR        0x10010000

            #define CY_APP0_CORE1_FLASH_LENGTH      0x30000

             

             

            #define CY_APP1_CORE0_FLASH_ADDR        0x10040000

            #define CY_APP1_CORE0_FLASH_LENGTH      0x20000

             

             

            #define CY_APP1_CORE1_FLASH_ADDR        0x10060000

            #define CY_APP1_CORE1_FLASH_LENGTH      0x60000

             

             

            /* DFU SDK metadata address range in Flash */

            #define CY_BOOT_META_FLASH_ADDR         0x100FFA00

            #define CY_BOOT_META_FLASH_LENGTH       0x200

             

             

            /* Application ranges in emulated EEPROM */

            #define CY_APP0_CORE0_EM_EEPROM_ADDR    0x14000000

            #define CY_APP0_CORE0_EM_EEPROM_LENGTH  0x00004000

             

             

            #define CY_APP0_CORE1_EM_EEPROM_ADDR    (CY_APP0_CORE0_EM_EEPROM_ADDR + CY_APP0_CORE0_EM_EEPROM_LENGTH)

            #define CY_APP0_CORE1_EM_EEPROM_LENGTH  0x00004000

             

             

            #define CY_APP1_CORE0_EM_EEPROM_ADDR    0x14000000

            #define CY_APP1_CORE0_EM_EEPROM_LENGTH  0x00004000

             

             

            #define CY_APP1_CORE1_EM_EEPROM_ADDR    (CY_APP1_CORE0_EM_EEPROM_ADDR + CY_APP1_CORE0_EM_EEPROM_LENGTH)

            #define CY_APP1_CORE1_EM_EEPROM_LENGTH  0x00004000

             

             

            /* Application ranges in SMIF XIP */

            #define CY_APP0_CORE0_SMIF_ADDR         0x18000000

            #define CY_APP0_CORE0_SMIF_LENGTH       0x00000000

             

             

            #define CY_APP0_CORE1_SMIF_ADDR         (CY_APP0_CORE0_SMIF_ADDR + CY_APP0_CORE0_SMIF_LENGTH)

            #define CY_APP0_CORE1_SMIF_LENGTH       0x00000000

             

             

            #define CY_APP1_CORE0_SMIF_ADDR         0x14000200

            #define CY_APP1_CORE0_SMIF_LENGTH       0x00000000

             

             

            #define CY_APP1_CORE1_SMIF_ADDR         (CY_APP1_CORE0_SMIF_ADDR + CY_APP1_CORE0_SMIF_LENGTH)

            #define CY_APP1_CORE1_SMIF_LENGTH       0x00000000

             

             

            /* Application ranges in RAM */

            #define CY_APP_RAM_COMMON_ADDR          0x08000000

            #define CY_APP_RAM_COMMON_LENGTH        0x00000100

             

            The application compiled successfully, but it doesn't run properly. Flashing the Bootloader App alone works well, however, when I flash the merged hex file that contains both App0 and App1. even App0 validates the Metadata step, and get stuck(like dead) while validating App1. The same happens if I decided to flash App0 only and use OTA to download the .cyacd2 for App1.

             

                 /* Initialize dfuParams structure and DFU SDK state */

                dfuParams.timeout      = paramsTimeout;

                dfuParams.dataBuffer   = &buffer[0];

                dfuParams.packetBuffer = &packet[0];

             

             

                status = Cy_DFU_Init(&state, &dfuParams);

             

             

             

             

                 /* Ensure DFU Metadata is valid */

                  printf("Metadata Status = %d\r\n", status);

                status = HandleMetadata(&dfuParams);

                if (status != CY_DFU_SUCCESS)

                {

                    printf("InValid Metadata\r\n");

                    Cy_SysLib_Halt(0x00u);

                }

                else

                {

                    printf("Valid Metadata\r\n"); //Printed

                   

                }

               

                /*

                * In the case of non-software reset and user does not

                * want to stay in App0, check if there is a valid app image.

                * If there is - switch to it.

                */

                if ((Cy_SysLib_GetResetReason() != CY_SYSLIB_RESET_SOFT) && (IsButtonPressed(2000u) == false))

                {

                    printf("Validating App1 now\r\n"); //Printed

                    status = Cy_DFU_ValidateApp(1u, &dfuParams);

                    printf("App1 Validation Status = %d \r\n", status);  //<<<< NOT Printed and nothing afterwards is done.

                    if (status == CY_DFU_SUCCESS)

                    {

                         printf("App1 Validation Success Status = %d \r\n", status);

                        /*       

                        * Clear reset reason because Cy_DFU_ExecuteApp() performs       

                        * a software reset.       

                        * Without clearing two reset reasons would be present.       

                        */

                        do

                        {

                            Cy_SysLib_ClearResetReason();

                        }while(Cy_SysLib_GetResetReason() != 0);

                        /* Never returns */

                        Cy_DFU_ExecuteApp(1u);

                    }

                    else

                    {

                        printf("App1 Validation Failed Status = %d \r\n", status);

                    }

                }

            • 3. Re: Problem Compiling project with Bluetooth DFU
              GaneshD_41

              Hi,

               

              Can you please attach the complete archive of your App0 and App1?

               

              Thanks

              Ganesh