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.

MSPM0L1106: Flash memory reservation

Part Number: MSPM0L1106
Other Parts Discussed in Thread: SYSCONFIG, UNIFLASH

Tool/software:

Hi Team,

In MSPM0L1106, it has 64KB flash memory. The firmware code size is already more than 40KB.

Is it possible to reserve 1KB flash memory, 0x7C00 to 0x7FFF, for data memory and program code will not be generated in this area?

Thanks.

  • Yes you can modify the .cmd file to define section with specific flash area.

  • Hi Yuhao,

    Thank you for your support.

    I found that there is one .cmd file in my project folder, device_linker.cmd, under directory, <project folder>\Debug\syscfg\. It seems that it is a generated file from CCS. Where should I modify it?

    AlanC.

  • Hi Yuhao,

    Furthermore, the following is my proposed modification. Will this cause any overlap error with FLASH?

    MEMORY
    {
    FLASH (RX) : origin = 0x00000000, length = 0x0000FFF8
    SRAM (RWX) : origin = 0x20000000, length = 0x00001000
    BCR_CONFIG (R) : origin = 0x41C00000, length = 0x00000080
    BSL_CONFIG (R) : origin = 0x41C00100, length = 0x00000080
    FLASH_DATA (R) : origin = 0x00007C00, length = 0x00000400    <<- Added
    }

    (Remark: .cmd file restored to original after compilation.)

    AlanC.

  • To modify the cmd file manually, first you need to copy the cmd file to the project. Then please disable the cmd generation in SysConfig.

  • Hi Yuhao,

    After the changes, I got the overlap error as my expected. Can you suggest how to modify the .cmd file?

    AlanC.

  • Please note there should not be any overlay on FLASH area. For example, FLASH (RX) : origin = 0x00000000, length = 0x0000FFF8, means it contains FLASH from 0x0000 to 0xFFF8. 

  • Hi Yuhao,

    Yes, I understand about it. This is the reason why I create this ticket.

    I want to know how to prevent the code generation at certain memory in between, eg. 0x7C00 with 1K data skipped for my case?

    AlanC. 

  • You need to define two parts of FLASH, one is FLASH1 for 0x0000-0x6bff, the other one is FLASH2 for 0x8000 - ...So  0x7C00 with 1K data will be skipped

    Then you need to define section as 

        .text   : palign(8) {} > FLASH1 | FLASH2

  • Hi YuHao,

    I modified the cmd file as you suggested as below, but there is still error on compilation as below.

    [109]Building target: "ChargingCase_MSPM0L1106.out"
    [110]Invoking: Arm Linker
    [111]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/bin/tiarmclang.exe" @"syscfg/device.opt"  -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O2 -gdwarf-3 -Wl,-m"ChargingCase_MSPM0L1106.map" -Wl,-i"c:/ti/mspm0_sdk_2_03_00_07/source" -Wl,-i"D:/Work/TI_MSPM0/ChargingCase_MSPM0L1106/Debug/syscfg" -Wl,-i"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/lib" -Wl,--diag_wrap=off -Wl,--display_error_number -Wl,--warn_sections -Wl,--xml_link_info="ChargingCase_MSPM0L1106_linkInfo.xml" -Wl,--rom_model -o "ChargingCase_MSPM0L1106.out" "./syscfg/ti_msp_dl_config.o" "./startup_mspm0l110x_ticlang.o" "./cc_mspm0l1106_main.o" "./Application/Src/app_main.o" "./Application/Src/battery.o" "./Application/Src/battery_type.o" "./Application/Src/earbud_protocol.o" "./Application/Src/hw_init.o" "./Application/Src/hw_init_common.o" "./Application/Src/i2c.o" "./Application/Src/led.o" "./Application/Src/low_bit_rate_comm.o" "./Application/Src/nvm.o" "./Application/Src/pwm.o" "./Application/Src/sw_timer.o" "./Application/Src/switch.o" "./Application/Src/uart.o" "./Application/Src/uart_protocol.o" "./HAL/hal.o" "../cc_mspm0l1106_linker.cmd"  -Wl,-ldevice.cmd.genlibs -Wl,-llibc.a 
    [112]makefile:164: recipe for target 'ChargingCase_MSPM0L1106.out' failed
    [113]"../cc_mspm0l1106_linker.cmd", line 50: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section, or the section contains padded functions. placement with alignment fails for section ".text" size 0x93b6.  Available memory ranges:
    [114]   FLASH        size: 0x7c00       unused: 0x6dc8       max hole: 0x6dc8    
    [115]   FLASH2       size: 0x7ff8       unused: 0x7ff8       max hole: 0x7ff8    
    [116]error #10010: errors encountered during linking; "ChargingCase_MSPM0L1106.out" not built
    [117]tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)
    [118]gmake[1]: *** [ChargingCase_MSPM0L1106.out] Error 1
    [119]gmake[1]: Target 'secondary-outputs' not remade because of errors.
    [120]makefile:160: recipe for target 'all' failed
    [121]gmake: *** [all] Error 2
    [122]**** Build Finished

    I also modified all the places marked "FLASH" to "FLASH | FLASH2", the error is still occurred. Is any other modification needed?

    AlanC.

  • According to 10.5.5. The SECTIONS Directive — TI Arm Clang Compiler Tools User's Guide, you need to use >> rather than >. And please remove palign(8). I think you can modify .text only and keep others as default. Here is my test, I create FLASH1 and FLASH2 for .text used only.

    Here is another different method.

    1. create different '.text' and put different function into them separately. Here is an example code.
      1. 2112.Attritube_memoryAllocation_C.zip
  • Hi YuHao,

    Thank you for your support. I modified the .cmd file as following, but the same error was resulted.

    I also tried your provided project, Attritube_memoryAllocation_C. However, the project cannot be compiled with the error attached.

    [0]**** Clean-only build of configuration Debug for project Attritube_memoryAllocation_C ****
    [1]"C:\\ti\\ccs2010\\ccs\\utils\\bin\\gmake" -k -j 8 clean -O 
     
    [2]DEL /F  "device.cmd.genlibs" "ti_msp_dl_config.h"  "device.opt" "ti_msp_dl_config.c"  "Attritube_memoryAllocation_C.out" 
    [3]DEL /F "empty.o" "ti_msp_dl_config.o" "startup_mspm0c110x_ticlang.o" 
    [4]DEL /F "empty.d" "ti_msp_dl_config.d" "startup_mspm0c110x_ticlang.d" 
    [5]Finished clean
     
    [6]**** Build Finished ****
    
    [7]**** Build of configuration Debug for project Attritube_memoryAllocation_C ****
    [8]"C:\\ti\\ccs2010\\ccs\\utils\\bin\\gmake" -k -j 8 all -O 
     
    [9]Building file: "../empty.syscfg"
    [10]Invoking: SysConfig
    [11]"C:/ti/sysconfig_1.21.0/sysconfig_cli.bat" --script "D:/Work/TI_MSPM0/Attritube_memoryAllocation_C/empty.syscfg" -o "." -s "C:/ti/mspm0_sdk_2_02_00_05/.metadata/product.json" --compiler ticlang
    [12]Running script...
    [13]Validating...
    [14]warning: /ti/project_config/ProjectConfig: All four File Generation options must be enabled in order to guarantee Device Migration support. If an option is disabled, the user must manually configure that setting on its own file.
    [15]Generating Code (empty.syscfg)...
    [16]Writing D:\Work\TI_MSPM0\Attritube_memoryAllocation_C\Debug\device.opt...
    [17]Writing D:\Work\TI_MSPM0\Attritube_memoryAllocation_C\Debug\device.cmd.genlibs...
    [18]Writing D:\Work\TI_MSPM0\Attritube_memoryAllocation_C\Debug\ti_msp_dl_config.c...
    [19]Writing D:\Work\TI_MSPM0\Attritube_memoryAllocation_C\Debug\ti_msp_dl_config.h...
    [20]0 error(s), 1 warning(s)
    [21]Finished building: "../empty.syscfg"
     
    [22]Building file: "../empty.c"
    [23]Invoking: Arm Compiler
    [24]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/bin/tiarmclang.exe" -c @"device.opt"  -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O2 -I"D:/Work/TI_MSPM0/Attritube_memoryAllocation_C" -I"D:/Work/TI_MSPM0/Attritube_memoryAllocation_C/Debug" -I"C:/ti/mspm0_sdk_2_02_00_05/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_02_00_05/source" -gdwarf-3 -MMD -MP -MF"empty.d_raw" -MT"empty.o"  @"./device.opt"  -o"empty.o" "../empty.c"
    [25]subdir_rules.mk:9: recipe for target 'empty.o' failed
    [26]../empty.c:52:16: warning: GCC does not allow 'section' attribute in this position on a function definition [-Wgcc-compat]
    [27]   52 | __attribute__((section(".test_3"))) __attribute__((retain))
    [28]      |                ^
    [29]../empty.c:52:52: warning: GCC does not allow 'retain' attribute in this position on a function definition [-Wgcc-compat]
    [30]   52 | __attribute__((section(".test_3"))) __attribute__((retain))
    [31]      |                                                    ^
    [32]../empty.c:62:5: error: use of undeclared identifier 'begin_3'; did you mean 'begin_2'?
    [33]   62 |     begin_3[0] = 0xFF;
    [34]      |     ^~~~~~~
    [35]      |     begin_2
    [36]../empty.c:40:15: note: 'begin_2' declared here
    [37]   40 | const uint8_t begin_2[8]
    [38]      |               ^
    [39]../empty.c:62:16: error: cannot assign to variable 'begin_2' with const-qualified type 'const uint8_t[8]' (aka 'const unsigned char[8]')
    [40]   62 |     begin_3[0] = 0xFF;
    [41]      |     ~~~~~~~~~~ ^
    [42]../empty.c:40:15: note: variable 'begin_2' declared const here
    [43]   40 | const uint8_t begin_2[8]
    [44]      | ~~~~~~~~~~~~~~^~~~~~~~~~
    [45]   41 | __attribute__((section(".test"))) __attribute__((retain))
    [46]      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [47]   42 | = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};
    [48]      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [49]2 warnings and 2 errors generated.
    [50]gmake: *** [empty.o] Error 1
    [51]Building file: "ti_msp_dl_config.c"
    [52]Invoking: Arm Compiler
    [53]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/bin/tiarmclang.exe" -c @"device.opt"  -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O2 -I"D:/Work/TI_MSPM0/Attritube_memoryAllocation_C" -I"D:/Work/TI_MSPM0/Attritube_memoryAllocation_C/Debug" -I"C:/ti/mspm0_sdk_2_02_00_05/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_02_00_05/source" -gdwarf-3 -MMD -MP -MF"ti_msp_dl_config.d_raw" -MT"ti_msp_dl_config.o"  @"./device.opt"  -o"ti_msp_dl_config.o" "ti_msp_dl_config.c"
    [54]Finished building: "ti_msp_dl_config.c"
     
    [55]Building file: "C:/ti/mspm0_sdk_2_02_00_05/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0c110x_ticlang.c"
    [56]Invoking: Arm Compiler
    [57]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/bin/tiarmclang.exe" -c @"device.opt"  -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O2 -I"D:/Work/TI_MSPM0/Attritube_memoryAllocation_C" -I"D:/Work/TI_MSPM0/Attritube_memoryAllocation_C/Debug" -I"C:/ti/mspm0_sdk_2_02_00_05/source/third_party/CMSIS/Core/Include" -I"C:/ti/mspm0_sdk_2_02_00_05/source" -gdwarf-3 -MMD -MP -MF"startup_mspm0c110x_ticlang.d_raw" -MT"startup_mspm0c110x_ticlang.o"  @"./device.opt"  -o"startup_mspm0c110x_ticlang.o" "C:/ti/mspm0_sdk_2_02_00_05/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0c110x_ticlang.c"
    [58]Finished building: "C:/ti/mspm0_sdk_2_02_00_05/source/ti/devices/msp/m0p/startup_system_files/ticlang/startup_mspm0c110x_ticlang.c"
     
    [59]gmake: Target 'all' not remade because of errors.
    
    [60]**** Build Finished ****
    

    AlanC.

  • No you need to use >> rather than > in SECTIONS of cmd file.

    Here is my test code as reference. I put the .text part in FLASH1 | FLASH2 by '.text   : {} >> FLASH1 | FLASH2'

    issue_cmd_file_modification.zip

  • Hi Yuhao Zhao,

    Thank you for your support. Eventually, I can make my code compiled. But I still have question on it. I made 2 version as below.

    The left one is the one that I can compiled with my code. However, it will leave some un-used space in section "FLASH" now. Later, it may cause compile error when the code size is increased. So I tried to group the FLASH and FLASH1 together and created the right side. With the right one, there is compile error as below.

    Is it possible to group FLASH and FLASH1 together and how?

    [0]**** Build of configuration Debug for project ChargingCase_MSPM0L1106 ****
    [1]"C:\\ti\\ccs2010\\ccs\\utils\\bin\\gmake" -k -j 16 all -O 
     
    [2]Building target: "ChargingCase_MSPM0L1106.out"
    [3]Invoking: Arm Linker
    [4]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/bin/tiarmclang.exe" @"syscfg/device.opt"  -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O2 -gdwarf-3 -Wl,-m"ChargingCase_MSPM0L1106.map" -Wl,-i"c:/ti/mspm0_sdk_2_03_00_07/source" -Wl,-i"D:/Work/TI_MSPM0/ChargingCase_MSPM0L1106/Debug/syscfg" -Wl,-i"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/lib" -Wl,--diag_wrap=off -Wl,--display_error_number -Wl,--warn_sections -Wl,--xml_link_info="ChargingCase_MSPM0L1106_linkInfo.xml" -Wl,--rom_model -o "ChargingCase_MSPM0L1106.out" "./syscfg/ti_msp_dl_config.o" "./startup_mspm0l110x_ticlang.o" "./cc_mspm0l1106_main.o" "./Application/Src/app_main.o" "./Application/Src/battery.o" "./Application/Src/battery_type.o" "./Application/Src/earbud_protocol.o" "./Application/Src/hw_init.o" "./Application/Src/hw_init_common.o" "./Application/Src/i2c.o" "./Application/Src/led.o" "./Application/Src/low_bit_rate_comm.o" "./Application/Src/nvm.o" "./Application/Src/pwm.o" "./Application/Src/sw_timer.o" "./Application/Src/switch.o" "./Application/Src/uart.o" "./Application/Src/uart_protocol.o" "./HAL/hal.o" "../cc_mspm0l1106_linker.cmd"  -Wl,-ldevice.cmd.genlibs -Wl,-llibc.a 
    [5]makefile:164: recipe for target 'ChargingCase_MSPM0L1106.out' failed
    [6]"../cc_mspm0l1106_linker.cmd", line 51: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section, or the section contains padded functions. placement with alignment fails for section ".cinit" size 0x58.  Available memory ranges:
    [7]   FLASH        size: 0x7c00       unused: 0x0          max hole: 0x0       
    [8]"../cc_mspm0l1106_linker.cmd", line 56: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section, or the section contains padded functions. placement with alignment fails for section ".binit" size 0x10.  Available memory ranges:
    [9]   FLASH        size: 0x7c00       unused: 0x0          max hole: 0x0       
    [10]error #10010: errors encountered during linking; "ChargingCase_MSPM0L1106.out" not built
    [11]tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)
    [12]gmake[1]: *** [ChargingCase_MSPM0L1106.out] Error 1
    [13]gmake[1]: Target 'secondary-outputs' not remade because of errors.
    [14]makefile:160: recipe for target 'all' failed
    [15]gmake: *** [all] Error 2
    
    [16]**** Build Finished 

    AlanC.

  • Hi Yuhao Zhao,

    I am sorry to tell you that UniFlash reported error during firmware download through BSL as below.


    After I modified the cmd file by adding palign(8) to the line ".text : palign(8) {} >> FLASH1 | FLASH2", it will cause compile error. Is it able to overcome this issue?

    [105]Building target: "ChargingCase_MSPM0L1106.out"
    [106]Invoking: Arm Linker
    [107]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/bin/tiarmclang.exe" @"syscfg/device.opt"  -march=thumbv6m -mcpu=cortex-m0plus -mfloat-abi=soft -mlittle-endian -mthumb -O2 -gdwarf-3 -Wl,-m"ChargingCase_MSPM0L1106.map" -Wl,-i"c:/ti/mspm0_sdk_2_03_00_07/source" -Wl,-i"D:/Work/TI_MSPM0/ChargingCase_MSPM0L1106/Debug/syscfg" -Wl,-i"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-armllvm_4.0.2.LTS/lib" -Wl,--diag_wrap=off -Wl,--display_error_number -Wl,--warn_sections -Wl,--xml_link_info="ChargingCase_MSPM0L1106_linkInfo.xml" -Wl,--rom_model -o "ChargingCase_MSPM0L1106.out" "./syscfg/ti_msp_dl_config.o" "./startup_mspm0l110x_ticlang.o" "./cc_mspm0l1106_main.o" "./Application/Src/app_main.o" "./Application/Src/battery.o" "./Application/Src/battery_type.o" "./Application/Src/earbud_protocol.o" "./Application/Src/hw_init.o" "./Application/Src/hw_init_common.o" "./Application/Src/i2c.o" "./Application/Src/led.o" "./Application/Src/low_bit_rate_comm.o" "./Application/Src/nvm.o" "./Application/Src/pwm.o" "./Application/Src/sw_timer.o" "./Application/Src/switch.o" "./Application/Src/uart.o" "./Application/Src/uart_protocol.o" "./HAL/hal.o" "../cc_mspm0l1106_linker.cmd"  -Wl,-ldevice.cmd.genlibs -Wl,-llibc.a 
    [108]makefile:164: recipe for target 'ChargingCase_MSPM0L1106.out' failed
    [109]"../cc_mspm0l1106_linker.cmd", line 51: warning #10092-D: split placement (&gt;>) ignored for ".text":  cannot split object with PALIGN operator
    [110]"../cc_mspm0l1106_linker.cmd", line 51: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section, or the section contains padded functions. placement with alignment fails for section ".text" size 0x931e.  Available memory ranges:
    [111]   FLASH1       size: 0x6c00       unused: 0x6c00       max hole: 0x6c00    
    [112]   FLASH2       size: 0x7ff8       unused: 0x7ff8       max hole: 0x7ff8    
    [113]error #10010: errors encountered during linking; "ChargingCase_MSPM0L1106.out" not built
    [114]tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)
    [115]gmake[1]: *** [ChargingCase_MSPM0L1106.out] Error 1
    [116]makefile:160: recipe for target 'all' failed
    [117]gmake[1]: Target 'secondary-outputs' not remade because of errors.
    [118]gmake: *** [all] Error 2
    
    [119]**** Build Finished

    AlanC.

  • To check the memory allocation, please use view - Memory Allocation