This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using printf function problem...

Other Parts Discussed in Thread: HALCOGEN, TMS570LS3137

Hi Everyone.

I have questions.

I using HDK(TMS570LS3137) and HALCOGEN Tool with Free RTOS option.

First Queation.

When I using printf function, I saw the follow message.

warning: creating output section ".sysmem" without a SECTIONS specification
warning: creating ".sysmem" section with default size of 0x800; use the -heap option to change the default size

So, I added ".sysmem  : {} > RAM" to .CMD File. and I cleared "warning: creating output section ".sysmem" without a SECTIONS specification"

But, I never clear "warning: creating ".sysmem" section with default size of 0x800; use the -heap option to change the default size"

How to clear the message?

 

Second Question.

I want printf function via SCI(UART), But I never found example code or Instructions.

How to use printf function via SCI?

 

Thanks

  • Hi Sang-Min,

    you can specify the "-heap" option in the linker command file (e.g. -heap=0x400) or in the Build Options Linker dialog in CCS. You can find more informations about this in the compiler manual on page 27 (SPNU151G).

    You can use the following example code for printf via SCI. the code uses the sciInit() and sciSend() functions generated by HALCoGen v2.11 and the vsnprintf() function out of the C standard library.

    /* USER CODE BEGIN (2) */
    int sci_printf(const char *_format, ...);
    /* USER CODE END */


    void main(void)
    {
    /* USER CODE BEGIN (3) */
       sciInit();

       while(1)
       {
          static unsigned int count = 0;
          sci_printf((const char*)"This is a hex number: 0x%08X\r", count++);
       }
    /* USER CODE END */
    }


    /* USER CODE BEGIN (4) */
    void sciNotification(sciBASE_t *sci, unsigned flags)
    {
       return;
    }

    int sci_printf(const char *_format, ...)
    {
       char str[128];
       int length = -1;

       va_list argList;
       va_start( argList, _format );

       length = vsnprintf(str, sizeof(str), _format, argList);

       va_end( argList );

       if (length > 0)
       { 
          sciSend(sciREG1, (unsigned)length, (unsigned char*)str);
       }

       return length;
    }
    /* USER CODE END */

    You also need to include "sci.h" and <stdio.h> to use this.

     

    Best Regards,

    Christian

  • Hi! Cristian.

    I solved my problems using user advices.

    Thank you very mush. ^^