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.

C5535 "printf" problem with "small memory model"

Hello,

I have the EZDSP C5535 kit with a small program on it.
When i compile with large memory model, "printf" function works well,
but when i compile with small memory model, "printf" never return...

I put a big heap and stack, and the rts library seem to be good (rts55.lib instead of rts55x.lib)

Do you have any idea about the problem?

Regards,

Max 

  • Does your program contain any hand-coded assembly code?

    If not, I would expect that if printf works in large memory model, that switching to small memory model should work.

    If your executable is small, could you post it here?

  • Hello,

    There is no assembly code on my Project...
    I take the project aic3204 from the test code of EZDSP board here: http://support.spectrumdigital.com/boards/ezdsp5535/revc/

    In large memory model everything is ok the project work.
    But in small memory model "printf" never return.

    I have CCS V5.3.0090,

    Regards,

    Max
     

  • I found that the problem seem to be in the linking file.

    For example i create a new project with "Hello world" for C5535 DSP.

    Here is the linking file which work:

    /* SPECIFY THE SYSTEM MEMORY MAP */

    MEMORY
    {
    MMR (RWIX): origin = 0x000000, length = 0x0000c0 /* MMRs */
    DARAM0 (RWIX): origin = 0x0000c0, length = 0x00ff40 /* 64KB - MMRs */
    SARAM0 (RWIX): origin = 0x010000, length = 0x010000 /* 64KB */
    SARAM1 (RWIX): origin = 0x020000, length = 0x020000 /* 128KB */
    SARAM2 (RWIX): origin = 0x040000, length = 0x00FE00 /* 64KB */
    VECS (RWIX): origin = 0x04FE00, length = 0x000200 /* 512B */
    PDROM (RIX) : origin = 0xff8000, length = 0x008000 /* 32KB */
    }

    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
    SECTIONS
    {
    .text >> SARAM0|SARAM1|SARAM2 /* Code */

    /* Both stacks must be on same physical memory page */
    .stack > DARAM0 /* Primary system stack */
    .sysstack > DARAM0 /* Secondary system stack */

    .data > DARAM0 /* Initialized vars */
    .bss > DARAM0 /* Global & static vars */
    .const > DARAM0 /* Constant data */
    .sysmem > DARAM0 /* Dynamic memory (malloc) */
    .switch > DARAM0 /* Switch statement tables */
    .cinit > DARAM0 /* Auto-initialization tables */
    .pinit > DARAM0 /* Initialization fn tables */
    .cio > DARAM0 /* C I/O buffers */
    .args > DARAM0 /* Arguments to main() */

    vectors > VECS /* Interrupt vectors */
    }

    Now if i only change ".bss > DARAM0" to ".bss      >>  DARAM0|SARAM0"
    "printf" never returns with small memory model.

    So in my current other project i tested to put bss in a single space of memory and now
    I have a message on the debug output:

    "Invalid CIO command (106) in the CIO buffer at address (0x4be8) was not recognized. Please check the device and program memory maps."

    Do you have any idea about the problem?
    I think there is issues with size of pointer in small memory model and access in memory:

    pointers (data):
    small memory mode:16 bits
    large memory mode: 23 bits
    pointers (function) 24 bits

    Do you have any idea on how to configure linker file in order it works?

    [EDIT] I modified my linker file to be unified memory (Only one SARAM and only one DARAM):

    PAGE 0: /* ---- Unified Program/Data Address Space ---- */

    MMR (RWIX): origin = 0x000000, length = 0x0000c0 /* MMRs */
    DARAM0 (RWIX): origin = 0x0000c0, length = 0x00ff40 /* 64KB - MMRs */
    SARAM0 (RWIX): origin = 0x010000, length = 0x03fe00 /* 64KB */
    VECS (RWIX): origin = 0x04FE00, length = 0x000200 /* 512B */
    PDROM (RIX) : origin = 0xff8000, length = 0x008000 /* 32KB */

    PAGE 2: /* -------- 64K-word I/O Address Space -------- */

    IOPORT (RWI) : origin = 0x000000, length = 0x020000

    And i put all section in SARAM0, now my "printf" works but the program stop when return from a function
    I think that all the memory is not directly accessible with "small memory model"
    But why i havn't got any warning from the linker? 

    Regards,

    Max

     


     

  • Posted a question to the compiler team on this topic:

    http://e2e.ti.com/support/development_tools/compiler/f/343/t/231950.aspx

    Regards,
    Mark