3 Replies Latest reply on Aug 11, 2020 12:20 AM by ShifangZ_26

    CYPD3171-24LQXQ_pb add printf, but build fail

    HuEd_3452391

      Hello

       

      I want to use

      https://www.cypress.com/documentation/code-examples/ce224431-psoc-4-uart-printf

      on CYPD3171-24LQXQ_pb. Here my steps

       

      1. Modify the Heap size from 0x80 to 0x380 -> build successful

      2. Add some code in main.c

       

      #if defined (__GNUC__)

         

          /* Add an explicit reference to the floating point printf library to allow

             use of floating point conversion specifier. */    

          asm (".global _printf_float");

       

          ...

      #endif /* (__GNUC__) */

        • 1. Re: CYPD3171-24LQXQ_pb add printf, but build fail
          HuEd_3452391

          3. Add below in main.c  - -> build fail

           

          #include <stdio.h>

           

          4. Add below in main.c  -> build fail

           

              int32 integerNum = -212121;

              float floatNum = 37.37f;   

              printf("Testing printf function. long: %ld , float: %f \r\n", integerNum, floatNum);

             

          5. build fail log as below, is it the .text region is not enough to accommodate the printf?

           

          \CYPD3171-24LQXQ_pb.elf section `.text' is not within region `rom'ERROR:

          \CYPD3171-24LQXQ_pb.elf section `.eh_frame' will not fit in region `rom'ERROR: address 0x14024 of \CYPD3171-24LQXQ_pb.elf section `.text' is not within region `rom'ERROR: address 0x14024 of \CYPD3171-24LQXQ_pb.elf section `.text' is not within region `rom'ERROR: Firmware binary overlaps with metadataERROR: section .cyloadablemeta loaded at [0000ffc0,0000ffff] overlaps section .text loaded at [00001000,00014023]ERROR: region `rom' overflowed by 0 bytesc:/program files (x86)/cypress/psoc creator/4.2/psoc creator/import/gnu/arm/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv6-m\libg_nano.a(lib_a-sbrkr.o): In function `_sbrk_r':

          sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'

          c:/program files (x86)/cypress/psoc creator/4.2/psoc creator/import/gnu/arm/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv6-m\libg_nano.a(lib_a-writer.o): In function `_write_r':

          writer.c:(.text._write_r+0x10): undefined reference to `_write'

           

           

           

           

          Thanks

          • 3. Re: CYPD3171-24LQXQ_pb add printf, but build fail
            ShifangZ_26

            Hi ,

             

            CCGx firmware is not support printf directly.

             

            Kindly refer the threads we have been offered in the community to debug the firmware with software UART.

            Re: printf

             

            Best Regards,

            Lisa