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.

File I\O - changing the directory of a file

Other Parts Discussed in Thread: CONTROLSUITE

Hi Guys,

I am using TMS32F28027 MCU and I have written a program for 3 phase Voltage measurement. I want to check my program by writing all the calculated values in an excel file using fwrite fuction. As the RAM has limited memory the compiler gives the following errors.

Is there any way to create excel file in another directory other than the RAM (for eg. in hard disk )?

Normally in eclipse IDE the line myFile = fopen("file.csv", "w"); is replaced with myFile = fopen("D:\\file.csv", "w"); to change the directory. This doesn't work in CCS.

Also I am open to other suggestions for checking the calculated voltage values. Thank You.

 

warning: creating output section ".cio" without a SECTIONS specification

warning: creating ".esysmem" section with default size of 0x400; use the -heap

option to change the default size

"D:/Software/controlSUITE/device_support/f2802x/v220/f2802x_common/cmd/F2802x_generic_ram.cmd", line 111: error:

program will not fit into available memory. placement with

alignment/blocking fails for section ".text" size 0x23b1 page 0. Available

memory ranges:

RAMM0 size: 0x3b0 unused: 0x0 max hole: 0x0

RAML0 size: 0x800 unused: 0x1 max hole: 0x1

.text : >> RAMM0 | RAML0, PAGE = 0

"D:/Software/controlSUITE/device_support/f2802x/v220/f2802x_common/cmd/F2802x_generic_ram.cmd", line 119: error:

program will not fit into available memory. placement with

alignment/blocking fails for section ".econst" size 0x261 page 1. Available

memory ranges:

RAMM1 size: 0x400 unused: 0x0 max hole: 0x0

.econst : > RAMM1, PAGE = 1

"D:/Software/controlSUITE/device_support/f2802x/v220/f2802x_common/cmd/F2802x_generic_ram.cmd", line 118: error:

program will not fit into available memory. run placement with

alignment/blocking fails for section ".ebss" size 0x220 page 1. Available

memory ranges:

RAMM1 size: 0x400 unused: 0x0 max hole: 0x0

.ebss : > RAMM1, PAGE = 1

"D:/Software/controlSUITE/device_support/f2802x/v220/f2802x_common/cmd/F2802x_generic_ram.cmd", line 117: error:

program will not fit into available memory. run placement with

alignment/blocking fails for section ".stack" size 0x200 page 1. Available

memory ranges:

RAMM1 size: 0x400 unused: 0x0 max hole: 0x0

.stack : > RAMM1, PAGE = 1

error: program will not fit into available memory. run placement with

alignment/blocking fails for section ".cio" size 0x120 page 1. Available

memory ranges:

BOOT_RSVD size: 0x4e unused: 0x4e max hole: 0x4e

RAMM1 size: 0x400 unused: 0x0 max hole: 0x0

DEV_EMU size: 0x105 unused: 0x101 max hole: 0x101

SYS_PWR_CTL size: 0x3 unused: 0x0 max hole: 0x0

FLASH_REGS size: 0x60 unused: 0x58 max hole: 0x58

CSM size: 0x10 unused: 0x0 max hole: 0x0

ADC_RESULT size: 0x20 unused: 0x0 max hole: 0x0

CPU_TIMER0 size: 0x8 unused: 0x0 max hole: 0x0

CPU_TIMER1 size: 0x8 unused: 0x0 max hole: 0x0

CPU_TIMER2 size: 0x8 unused: 0x0 max hole: 0x0

PIE_CTRL size: 0x20 unused: 0x6 max hole: 0x6

PIE_VECT size: 0x100 unused: 0x0 max hole: 0x0

COMP1 size: 0x20 unused: 0xf max hole: 0xf

COMP2 size: 0x20 unused: 0xf max hole: 0xf

EPWM1 size: 0x40 unused: 0x0 max hole: 0x0

EPWM2 size: 0x40 unused: 0x0 max hole: 0x0

EPWM3 size: 0x40 unused: 0x0 max hole: 0x0

EPWM4 size: 0x40 unused: 0x0 max hole: 0x0

ECAP1 size: 0x20 unused: 0x0 max hole: 0x0

GPIOCTRL size: 0x40 unused: 0x0 max hole: 0x0

GPIODAT size: 0x20 unused: 0x0 max hole: 0x0

GPIOINT size: 0x20 unused: 0x16 max hole: 0x16

SYSTEM size: 0x20 unused: 0x1 max hole: 0x1

SPIA size: 0x10 unused: 0x0 max hole: 0x0

SCIA size: 0x10 unused: 0x0 max hole: 0x0

NMIINTRUPT size: 0x10 unused: 0x0 max hole: 0x0

XINTRUPT size: 0x10 unused: 0x0 max hole: 0x0

ADC size: 0x80 unused: 0x2f max hole: 0x2f

I2CA size: 0x40 unused: 0x1e max hole: 0x1e

PARTID size: 0x1 unused: 0x0 max hole: 0x0

CSM_PWL size: 0x8 unused: 0x0 max hole: 0x0

"D:/Software/controlSUITE/device_support/f2802x/v220/f2802x_common/cmd/F2802x_generic_ram.cmd", line 110: error:

program will not fit into available memory. placement with

alignment/blocking fails for section "ramfuncs" size 0x4 page 0. Available

memory ranges:

RAMM0 size: 0x3b0 unused: 0x0 max hole: 0x0

RAML0 size: 0x800 unused: 0x1 max hole: 0x1

ramfuncs : >> RAMM0 | RAML0 PAGE = 0

warning: entry-point symbol other than "_c_int00" specified: "code_start"

error: errors encountered during linking; "Example_2802xAdcSoc.out" not built

>> Compilation failure

gmake: *** [Example_2802xAdcSoc.out] Error 1

gmake: Target `all' not remade because of errors.

  • Prakash, instead burst out the data through SCI into terminal app and later link it to excel externally. file operations are that too for F28027 would not be reliable.

    Check this: processors.wiki.ti.com/index.php/Tips_for_using_printf

    Regards,
    Gautam
  • Hi Gautam,

    Thanks for your reply. I didn't want to make things complicated for me with SCI. So I decided to use printf function. I set the heap size to 0x400. Reallocated the memory for IQTables to RAMM0, but still get errors.

    CODE:
    #include <stdio.h>
    int main(void) {
    printf("Hello, world!");
    return 0; }

    MEMORY
    {
    PAGE 0 :
    /* For this example, L0 is split between PAGE 0 and PAGE 1 */
    /* BEGIN is used for the "boot to SARAM" bootloader mode */

    BEGIN : origin = 0x000000, length = 0x000002
    RAMM0 : origin = 0x3FE000, length = 0x000C86
    PRAML0 : origin = 0x008000, length = 0x000900
    RESET : origin = 0x3FFFC0, length = 0x000002

    // IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */
    // IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */
    // IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */

    BOOTROM : origin = 0x3FF27C, length = 0x000D44

    PAGE 1 :

    /* For this example, L0 is split between PAGE 0 and PAGE 1 */
    BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0, BOOT rom will use this for stack */
    RAMM1 : origin = 0x000050, length = 0x0007B0 /* on-chip RAM block M1 */
    DRAML0 : origin = 0x008900, length = 0x000700
    }

    SECTIONS
    {
    /* Setup for "boot to SARAM" mode:
    The codestart section (found in DSP28_CodeStartBranch.asm)
    re-directs execution to the start of user code. */
    codestart : > BEGIN, PAGE = 0
    ramfuncs : > RAMM0, PAGE = 0

    .text:cio : { rts*.lib<ankmsg.obj exit.obj>(.text) } > RAMM0, PAGE = 0
    .text:rts : { rts*.lib(.text) } > RAMM0, PAGE = 0
    .text > RAMM0, PAGE = 0

    .cinit : > RAMM0, PAGE = 0
    .pinit : > RAMM0, PAGE = 0
    .switch : > RAMM0, PAGE = 0
    .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */

    .stack : > RAMM1, PAGE = 1
    .ebss : > DRAML0, PAGE = 1
    .econst : > DRAML0, PAGE = 1
    .esysmem : > RAMM1, PAGE = 1

    // IQmath : > PRAML0, PAGE = 0
    // IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
    }

    ERRORS:

    "D:\\Software\\CCS\\ccsv6\\ccsv6\\utils\\bin\\gmake" -k all
    'Building target: print.out'
    'Invoking: C2000 Linker'
    "D:/Software/CCS/ccsv6/ccsv6/tools/compiler/ti-cgt-c2000_6.4.6/bin/cl2000" -v28 -ml -mt -g --diag_warning=225 --display_error_number --diag_wrap=off --printf_support=full -z -m"print.map" --stack_size=0x300 --heap_size=0x400 --warn_sections -i"D:/Software/CCS/ccsv6/ccsv6/tools/compiler/ti-cgt-c2000_6.4.6/lib" -i"D:/Software/CCS/ccsv6/ccsv6/tools/compiler/ti-cgt-c2000_6.4.6/include" --reread_libs --display_error_number --diag_wrap=off --xml_link_info="print_linkInfo.xml" --rom_model -o "print.out" "./main.obj" "../28027_RAM_lnk.cmd" -l"libc.a"

    <Linking>
    warning #10247-D: creating output section ".cio" without a SECTIONS specification
    "../28027_RAM_lnk.cmd", line 116: error #10099-D: program will not fit into available memory. placement with alignment/blocking fails for section ".text:rts" size 0x1b2a page 0. Available memory ranges:
    RAMM0 size: 0xc86 unused: 0xb53 max hole: 0xb53
    error #10010: errors encountered during linking; "print.out" not built

    >> Compilation failure
    gmake: *** [print.out] Error 1
    gmake: Target `all' not remade because of errors.
  • Did you follow the wiki link thoroughly? There seems to be an error in linking. Check your .text:rts section
  • Thanks again Gautam.
    It seems the size of .text:rts is 0x1b2a. Now I allocated more memory to RAMM0.
    It compiles and when I debug and run it, nothing gets printed in the CDT Build Console[print].
    Am I missing any settings here? Please let me know.
  • At last I am using breakpoints to write data to txt file. The following video shows how it is done.

    https://www.youtube.com/watch?v=Wk3l_dn0yKE

  • Cool! Thanks for sharing Prakash.

    Goodluck & Regards,
    Gautam