Part Number: TMS320F280049C
Other Parts Discussed in Thread: CODECOMPOSER
Tool/software:
On a TMS320F280049C, we had this snippet of code in two different functions in our project. One is placed in GSRAM (let’s call it funcRAM) and the other in flash (funcFLASH). funcFlash executes correctly (Ptr->x is updated) but the other one does not. Here’s the snippet:
if (rxCAN.msg <= 8U) {
Ptr->x= rxCAN.msg;
} else {
Ptr->x= 8U;
}
flag = true;
To add more details:
The code is executed using CPU, not CLA.
One of the functions is executed when message A is received and the other one when B is received. Flag will trigger an answer, thus we know that each is executed at the right time and that the code passes through the lines where Ptr->x is updated. What I’m trying to say is that the rest of the code shouldn’t be the problem, it is localized here.
Furthermore, Ptr points to a struct which is located in GSRAM (address of the struct 0xd180) but the pointer itself is in flash (addresss 0x912be). funcRAM is run from address 0x12000. This function also accesses a specific part of the 0xd180 struct using another pointer which is itself in RAM (address 0xc004). That other code, which does not use the flash pointer, works both on funcRAM and funcFLASH.
We no longer need funcRAM to be executed from RAM and thus we have a workaround. On the other hand, we need to understand why this happens to uncover any possible bugs stemming from the same root cause. On the past, we observed also different behavior on some code depending if it was placed on LSRAM or GSRAM (executed with CPU, not CLA). I don’t have the details top of mind; I would have to dig them if needed. I would like to know if that behavior is related or it is something different.
The code was generated using Simulink, btw, although I don’t think it has anything to do with that.
This is taken from our Makefile:
C:/ti/ccs1210/ccs/tools/compiler/ti-cgt-c2000_22.6.0.LTS/bin/cl2000" --define=MODEL=fw_EPC_50A_NI --define=NUMST=2 --define=NCSTATES=0 --define=HAVESTDIO --define=MODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 --define=CLASSIC_INTERFACE=0 --define=ALLOCATIONFCN=0 --define=TID01EQ=0 --define=CLA_BLOCK_INCLUDED --define=TERMFCN=0 --define=ONESTEPFCN=1 --define=MAT_FILE=0 --define=MULTI_INSTANCE_CODE=0 --define=INTEGER_CODE=0 --define=MT=1 --define=DAEMON_MODE=1 --define=XCP_CUSTOM_PLATFORM --define=EXTMODE_DISABLE_ARGS_PROCESSING=1 --define=MW_PIL_SCIFIFOLEN=16 --define=CPU1 --define=F2837X_REG_FORMAT --define=MW_F28004X --define=STACK_SIZE=1024 --define=__MW_TARGET_USE_HARDWARE_RESOURCES_H__ --define=RT --define=F280049C --define=BOOT_FROM_FLASH=1 --define=CPU_RAMLS_DATA_START=0x8800 --define=CPU_RAMLS_DATA_LENGTH=0x800 --define=CPU_RAMLS_PROG_START=0x8000 --define=CPU_RAMLS_PROG_LENGTH=0x800 --define=CLA_RAMLS_PROG_START=0x9800 --define=CLA_RAMLS_PROG_LENGTH=0x2800 --define=CLA_RAMLS_DATA_START=0x9000 --define=CLA_RAMLS_DATA_LENGTH=0x800 --abi=coffabi -s -v28 -ml --abi=coffabi --preproc_dependency=@:%.obj=%.dep) --preproc_with_compile --large_memory_model --silicon_version=28 --define=LARGE_MODEL -I -I/include -I -O3 --opt_for_speed=5 --unified_memory --idiv_support=none --cla_signed_compare_workaround=on -k -DCLA_BLOCK_INCLUDED --cla_support=cla2 -v28 --float_support=fpu32 -ml -DF280049C -DBOOT_FROM_FLASH=1 --tmu_support=tmu0 --fp_mode=relaxed -DCPU_RAMLS_DATA_START=0x8800 -DCPU_RAMLS_DATA_LENGTH=0x800 -DCPU_RAMLS_PROG_START=0x8000 -DCPU_RAMLS_PROG_LENGTH=0x800 -DCLA_RAMLS_PROG_START=0x9800 -DCLA_RAMLS_PROG_LENGTH=0x2800 -DCLA_RAMLS_DATA_START=0x9000 -DCLA_RAMLS_DATA_LENGTH=0x800 -z --warn_sections -i"C:/ti/ccs1210/ccs/tools/compiler/ti-cgt-c2000_22.6.0.LTS/lib" -i"C:/ti/ccs1210/ccs/tools/compiler/ti-cgt-c2000_22.6.0.LTS/include" --reread_libs --define=CLA_BLOCK_INCLUDED --define=F280049C --define=BOOT_FROM_FLASH=1 --define=BOOT_USING_BL=0 --define=CPU_RAMLS_DATA_START=0x8800 --define=CPU_RAMLS_DATA_LENGTH=0x800 --define=CPU_RAMLS_PROG_START=0x8000 --define=CPU_RAMLS_PROG_LENGTH=0x800 --define=CLA_RAMLS_PROG_START=0x9800 --define=CLA_RAMLS_PROG_LENGTH=0x2800 --define=CLA_RAMLS_DATA_START=0x9000 --define=CLA_RAMLS_DATA_LENGTH=0x800 --rom_model --stack_size=1024 --warn_sections --heap_size=1024 --reread_libs --rom_model --priority -mfw_project.map -o "fw_project.out" $(ORDERED_OBJS)
Thank you in advance.





