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.

How can I use the functions of "powf, log10...etc" at CCS?

Other Parts Discussed in Thread: CC430F6137, CC430F5137

Hi I'm using CCSv5 to implement an application at CC4306137.

But When I try to use 'powf' function at math.h files, it ocured some error statements like following image.

If I try to compile this project without powf, it did success. 

I certainly included "math.h" header file.

I don't know how to use these functions that exist at math.h file.

I really hope you to help me out.

I'll look forward your answers

thanks.

  • Hi Jo,

    There are two things I recommend checking first

    - your code is not too large for the device and/or if you are using the code size limited license, you are not going over the imposed limit

    - double check your include paths and options as per this wiki

    http://processors.wiki.ti.com/index.php/Include_paths_and_options

    Please keep us informed.

    Best Regards,
    Lisa

  • thanks for your reply.

    I think it's not the problem of ilnk setting.

    you can see the reason why I tell you that's not the problem.

    please see the following picture.

    as you can see, it's the debugging mode, so there is no problem at compiling

    but when I checked the result, tmp = 100/3+1;

    I couldn't see the result 34.

    I don't know the reason....

    please help me out.

  • Hi Jo,

    so is you problem simply that you can not see that variable in the expressions window?  Is that correct? 

    One reason this could be is if the variable has been optimized out.  What optimization settings do you use?  Have you defined tmp as static or volatile?

    Best Regards,
    Lisa

  • Jo yonhghyun said:

    But When I try to use 'powf' function at math.h files, it ocured some error statements like following image.

    The error is telling you that you do not have any more space in the section of memory you allocated your code to. Can I see the output in the build Console? You should have gotten some linker errors that detail this.

    Thanks

    ki

  • Jo yonhghyun said:
    as you can see, it's the debugging mode, so there is no problem at compiling

    The error you mentioned in your first post looked to be some build error. If the program built successfully, then either the errors were left over or from somewhere else. It is hard to understand what the issues are. Could you try using a new workspace? Hopefully that will clear up the first issue and it will be easier to understand what the real problem is.

    Thanks

    ki

  • Hi Ki, As you wrote down, it's a memory problem.

    the error message is following. this error message occur when I use "powf" function at <math.h>.

    <Linking>
    "../lnk_cc430f6137_4+32.cmd", line 114: error #10099-D: program will not fit
    into available memory. run placement with alignment fails for section
    ".sysmem" size 0x3e8 . Available memory ranges:
    RAM size: 0xffe unused: 0xf0 max hole: 0xee
    error #10010: errors encountered during linking; "EnergyAwareRouting_00.out"
    not built

    >> Compilation failure
    gmake: *** [EnergyAwareRouting_00.out] Error 1
    gmake: Target `all' not remade because of errors.

    So how can I make fit into our CC4306137 memory to use powf function?

    thanks.

  • Can you attach the linker command file (*.cmd) file you are using?

    Thanks

    ki

  • Okay the cmd file I'm using is the following..

    /******************************************************************************/
    /* lnk_cc430_4+32.cmd */
    /* */
    /* LINKER COMMAND FILE FOR LINKING CC430's WITH 4KB SRAM AND 32KB FLASH */
    /* */
    /* Relevant parts: CC430F5137, CC430F6137 */
    /* */
    /* Usage: lnk430 <obj files...> -o <out file> -m <map file> lnk.cmd */
    /* cl430 <src files...> -z -o <out file> -m <map file> lnk.cmd */
    /* */
    /*----------------------------------------------------------------------------*/
    /* These linker options are for command line linking only. For IDE linking, */
    /* you should set your linker options in Project Properties */
    /* -c LINK USING C CONVENTIONS */
    /* -stack 0x0100 SOFTWARE STACK SIZE */
    /* -heap 0x0100 HEAP AREA SIZE */
    /* */
    /*----------------------------------------------------------------------------*/


    /****************************************************************************/
    /* SPECIFY THE SYSTEM MEMORY MAP */
    /****************************************************************************/

    MEMORY
    {
    SFR : origin = 0x0000, length = 0x0010
    PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
    PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
    RAM : origin = 0x1C00, length = 0x0FFE
    INFOA : origin = 0x1980, length = 0x0080
    INFOB : origin = 0x1900, length = 0x0080
    INFOC : origin = 0x1880, length = 0x0080
    INFOD : origin = 0x1800, length = 0x0080
    FLASH_VL_OV : origin = 0x8000, length = 0x0360
    FLASH_VL_ISFS : origin = 0x8360, length = 0x00A0
    /*FLASH_VL_GFB : origin = 0x8400, length = 0x0000*/
    FLASH_VL_ISF : origin = 0x8400, length = 0x0600
    FLASH_VL_EXT : origin = 0x8A00, length = 0x0600
    FLASH : origin = 0x9000, length = 0x6F80
    INT00 : origin = 0xFF80, length = 0x0002
    INT01 : origin = 0xFF82, length = 0x0002
    INT02 : origin = 0xFF84, length = 0x0002
    INT03 : origin = 0xFF86, length = 0x0002
    INT04 : origin = 0xFF88, length = 0x0002
    INT05 : origin = 0xFF8A, length = 0x0002
    INT06 : origin = 0xFF8C, length = 0x0002
    INT07 : origin = 0xFF8E, length = 0x0002
    INT08 : origin = 0xFF90, length = 0x0002
    INT09 : origin = 0xFF92, length = 0x0002
    INT10 : origin = 0xFF94, length = 0x0002
    INT11 : origin = 0xFF96, length = 0x0002
    INT12 : origin = 0xFF98, length = 0x0002
    INT13 : origin = 0xFF9A, length = 0x0002
    INT14 : origin = 0xFF9C, length = 0x0002
    INT15 : origin = 0xFF9E, length = 0x0002
    INT16 : origin = 0xFFA0, length = 0x0002
    INT17 : origin = 0xFFA2, length = 0x0002
    INT18 : origin = 0xFFA4, length = 0x0002
    INT19 : origin = 0xFFA6, length = 0x0002
    INT20 : origin = 0xFFA8, length = 0x0002
    INT21 : origin = 0xFFAA, length = 0x0002
    INT22 : origin = 0xFFAC, length = 0x0002
    INT23 : origin = 0xFFAE, length = 0x0002
    INT24 : origin = 0xFFB0, length = 0x0002
    INT25 : origin = 0xFFB2, length = 0x0002
    INT26 : origin = 0xFFB4, length = 0x0002
    INT27 : origin = 0xFFB6, length = 0x0002
    INT28 : origin = 0xFFB8, length = 0x0002
    INT29 : origin = 0xFFBA, length = 0x0002
    INT30 : origin = 0xFFBC, length = 0x0002
    INT31 : origin = 0xFFBE, length = 0x0002
    INT32 : origin = 0xFFC0, length = 0x0002
    INT33 : origin = 0xFFC2, length = 0x0002
    INT34 : origin = 0xFFC4, length = 0x0002
    INT35 : origin = 0xFFC6, length = 0x0002
    INT36 : origin = 0xFFC8, length = 0x0002
    INT37 : origin = 0xFFCA, length = 0x0002
    INT38 : origin = 0xFFCC, length = 0x0002
    INT39 : origin = 0xFFCE, length = 0x0002
    INT40 : origin = 0xFFD0, length = 0x0002
    INT41 : origin = 0xFFD2, length = 0x0002
    INT42 : origin = 0xFFD4, length = 0x0002
    INT43 : origin = 0xFFD6, length = 0x0002
    INT44 : origin = 0xFFD8, length = 0x0002
    INT45 : origin = 0xFFDA, length = 0x0002
    INT46 : origin = 0xFFDC, length = 0x0002
    INT47 : origin = 0xFFDE, length = 0x0002
    INT48 : origin = 0xFFE0, length = 0x0002
    INT49 : origin = 0xFFE2, length = 0x0002
    INT50 : origin = 0xFFE4, length = 0x0002
    INT51 : origin = 0xFFE6, length = 0x0002
    INT52 : origin = 0xFFE8, length = 0x0002
    INT53 : origin = 0xFFEA, length = 0x0002
    INT54 : origin = 0xFFEC, length = 0x0002
    INT55 : origin = 0xFFEE, length = 0x0002
    INT56 : origin = 0xFFF0, length = 0x0002
    INT57 : origin = 0xFFF2, length = 0x0002
    INT58 : origin = 0xFFF4, length = 0x0002
    INT59 : origin = 0xFFF6, length = 0x0002
    INT60 : origin = 0xFFF8, length = 0x0002
    INT61 : origin = 0xFFFA, length = 0x0002
    INT62 : origin = 0xFFFC, length = 0x0002
    RESET : origin = 0xFFFE, length = 0x0002
    }

    /****************************************************************************/
    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
    /****************************************************************************/

    SECTIONS
    {
    .bss : {} > RAM /* GLOBAL & STATIC VARS */
    .sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */
    .stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */

    .vl_ov : {} > FLASH_VL_OV /* All VL data is for the filesystem */
    .vl_isfs : {} > FLASH_VL_ISFS
    /* .vl_gfb : {} > FLASH_VL_GFB */
    .vl_isf : {} > FLASH_VL_ISF
    .vl_ext : {} > FLASH_VL_EXT

    .text : {} > FLASH /* CODE */
    .cinit : {} > FLASH /* INITIALIZATION TABLES */
    .const : {} > FLASH /* CONSTANT DATA */
    .cio : {} > RAM /* C I/O BUFFER */

    .pinit : {} > FLASH /* C++ CONSTRUCTOR TABLES */

    .infoA : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */
    .infoB : {} > INFOB
    .infoC : {} > INFOC
    .infoD : {} > INFOD

    .int00 : {} > INT00 /* MSP430 INTERRUPT VECTORS */
    .int01 : {} > INT01
    .int02 : {} > INT02
    .int03 : {} > INT03
    .int04 : {} > INT04
    .int05 : {} > INT05
    .int06 : {} > INT06
    .int07 : {} > INT07
    .int08 : {} > INT08
    .int09 : {} > INT09
    .int10 : {} > INT10
    .int11 : {} > INT11
    .int12 : {} > INT12
    .int13 : {} > INT13
    .int14 : {} > INT14
    .int15 : {} > INT15
    .int16 : {} > INT16
    .int17 : {} > INT17
    .int18 : {} > INT18
    .int19 : {} > INT19
    .int20 : {} > INT20
    .int21 : {} > INT21
    .int22 : {} > INT22
    .int23 : {} > INT23
    .int24 : {} > INT24
    .int25 : {} > INT25
    .int26 : {} > INT26
    .int27 : {} > INT27
    .int28 : {} > INT28
    .int29 : {} > INT29
    .int30 : {} > INT30
    .int31 : {} > INT31
    .int32 : {} > INT32
    .int33 : {} > INT33
    .int34 : {} > INT34
    .int35 : {} > INT35
    .int36 : {} > INT36
    .int37 : {} > INT37
    .int38 : {} > INT38
    .int39 : {} > INT39
    .int40 : {} > INT40
    .int41 : {} > INT41
    .int42 : {} > INT42
    .int43 : {} > INT43
    .int44 : {} > INT44
    .int45 : {} > INT45
    .int46 : {} > INT46
    .int47 : {} > INT47
    .int48 : {} > INT48
    .int49 : {} > INT49
    .int50 : {} > INT50
    .int51 : {} > INT51
    .int52 : {} > INT52
    .int53 : {} > INT53
    .int54 : {} > INT54
    .int55 : {} > INT55
    .int56 : {} > INT56
    .int57 : {} > INT57
    .int58 : {} > INT58
    .int59 : {} > INT59
    .int60 : {} > INT60
    .int61 : {} > INT61
    .int62 : {} > INT62
    .reset : {} > RESET /* MSP430 RESET VECTOR */
    }

    /****************************************************************************/
    /* INCLUDE PERIPHERALS MEMORY MAP */
    /****************************************************************************/

    -l cc430f6137.cmd

  • The original error:

    Jo yonhghyun said:
    ".sysmem" size 0x3e8 . Available memory ranges:
    RAM size: 0xffe unused: 0xf0 max hole: 0xee

    So RAM is of size 0xffe but you only have 0xf0 space left which is too small for .sysmem section of size 0x3e8. Move .sysmem to another location where there is more space or move the other sections using RAM (like .stack, .bss, .cio) or reduce the size of them.

    I suggest reading section 7.5 of the assembly language user's guide to learn more about linker command files and how to modify them:

    http://www.ti.com/lit/ug/slau131e/slau131e.pdf

    Hope this helps

    ki