Tool/software: TI C/C++ Compiler
Hi Guys,
please can you take a into this question related to compiler warning of addressing overflow:
I found e2e threads with similar problems (e.g. e2e.ti.com/.../228000, but unfortunately they didn’t help to resolve the warning
Goal: Be able to read values from three Look-Up-Tables (~40 KByte total) during CLA tasks
Approach: Write LUT to flash bank (BANK0 SEC4-9), load LUT from flash to global shared RAM (GS1, GS2, GS3), access in CLA task
Problem: Relocation overflowed warning when trying to access LUT values with 17-Bit addresses
claT.cla:
#include “claV.h”
#include “claShared.h”
[...]
interrupt void cla_task1()
{
temp = LUT1[3][4][5]; // Works because LUT1 is in the 16-Bit Address Range
temp = LUT2[1][1][1]; // Works because this particular part of LUT2 is still in the 16-Bit Address Range
temp = LUT2[8][28][25]; // Doesn’t work because this part of LUT2 is already in the 17-Bit Address Range
temp = LUT3[1][1][1]; // Doesn’t work because LUT3 is completely in the 17-Bit Address range
AdccRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
}
Warning message:
warning: relocation from function “cla_task1”
to symbol "LUT3 " overflowed; the 17-bit relocated address
0x11811 is too large to encode in the 16-bit unsigned field (type =
'R_ABS16_OC' (107), file = "../target/obj/claT.obj", offset = 0x00000008,
section = "Cla1Prog:_cla_task1")
warning: output file cannot be loaded and run on a target system
claV.h:
#include "claShared.h"
[...]
#pragma DATA_SECTION (temp, "Cla1DataRam");
volatile Uint16 temp;
claShared.h:
#ifndef CLASHARED_H_
#define CLASHARED_H_
[...]
#endif /* CLASHARED_H_ */
extern const Uint16 LUT1[9][29][26];
extern const Uint16 LUT2[9][29][26];
extern const Uint16 LUT3[9][29][26];
LUT.h:
#ifndef LUT_H_
#define LUT_H_
#pragma DATA_SECTION (LUT1, "Cla1LUT");
const Uint16 LUT1[9][29][26] =
{
[...]
}
#pragma DATA_SECTION (LUT2, "Cla1LUT");
const Uint16 LUT2[9][29][26] =
{
[...]
}
#pragma DATA_SECTION (LUT3, "Cla1LUT");
const Uint16 LUT3[9][29][26] =
{
[...]
}
#endif /* LUT_H_ */
claC.c:
#include “claShared.h”
[...]
extern Uint16 Cla1LUTRunStart, Cla1LUTLoadStart, Cla1LUTLoadSize;
void claC_Init(void)
{
[...]
MemCopyWdg(&Cla1LUTRunStart, &Cla1LUTLoadStart, (size_t)&Cla1LUTLoadSize);
[...]
}
28004x_lnk.cmd:
MEMORY
{
PAGE 0
[...]
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000
PAGE 1 :
[...]
RAMLS2 : origin = 0x009000, length = 0x000800
FLASH_BANK0_SEC4_9 : origin = 0x084000, length = 0x006000
RAMGS123 : origin = 0x00E000, length = 0x006000
}
SECTIONS
{
[...]
.econst : > FLASH_BANK0_SEC4_9, PAGE = 1, ALIGN(4)
Cla1Prog : LOAD = FLASH_BANK1_SEC4,
RUN = RAMLS0,
LOAD_START(_Cla1funcsLoadStart),
LOAD_END(_Cla1funcsLoadEnd),
RUN_START(_Cla1funcsRunStart),
LOAD_SIZE(_Cla1funcsLoadSize),
PAGE = 0
Cla1DataRam : > RAMLS2, PAGE = 1
Cla1LUT : LOAD = FLASH_BANK0_SEC4_9,
RUN = RAMGS123,
LOAD_START(_Cla1LUTLoadStart),
LOAD_END(_Cla1LUTLoadEnd),
RUN_START(_Cla1LUTRunStart),
LOAD_SIZE(_Cla1LUTLoadSize),
PAGE = 1
}