application locationion

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16898
Level 4
Level 4
Hi,
I have two applications on my MCU flash, boot loader and actual application.

My question is how can i change application code location ?

during compilation compiler always set program data starting from 0x800000 address
hex line:
:0200000480007A


I want to have boot loader hard-coded on flash, logic sectors 1-4 (0x800000) and application code on further logic sectors( f.e. from 0x800F00).
software will be updated via uart and hex file and through boot loader code, how can I change application data adressing( Pflash),
so it won't overwrite boot loader code ?


I work on tc222L
TASKING toolset 6.3.1r
0 Likes
15 Replies
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
Hello Lukas,

since you are not using the AURIX Development Studio but the TASKING TriCore tools v6.3r1 I suggest to contact the TASKING tools support directly for questions related to the TASKING tools.

Some information which might help.

The reset vector for an AURIX application is set to 0xA0000020 be default. This is the start location for a start from internal flash. The reset vector then jumps to the C startup code which takes care of initializing the SFR registers and the variables, setting up the stacks and CSA etc. The C startup code then jumps to the 'main' function of the application.

You can modify the reset vector in menu:

Project -> Properties -> C/C++ Build -> Memory

in the tab named Special Areas.

To place the application code and const data in a certain range you can change the section name of the code and const data sections using e.g.

#pragma section all "APPLICATION"

to change all section names following that pragma to .
.APPLICATION

Then you can create a linker LSL file group to select those sections and have the group start at address 0x800F0000. E.g.:

section_layout :vtc:linear
{
group APPLICATION_CODE_AND_CONST ( ordered, contiguous, run_addr = 0x800F0000 )
{
select ".text.APPLICATION";
select ".rodata.APPLICATION";
}
}


Best regards,
Ulrich Kloidt

TASKING tools support
0 Likes
User16898
Level 4
Level 4
Hi thanks for answer,
where do i need to place #pragma section all "APPLICATION" ? in file with main or in every file in project ?

i tried to change to reset vector under 0x80018020
and application code at 0x80018000 (tc222L logic sector 6)

my lsl file looks like:
section_layout :vtc:linear
{
group APPLICATION_CODE_AND_CONST ( ordered, contiguous, run_addr = 0x8018000 )
{
select ".text.app";
select ".rodata.app";
}
}


I also placed #pragma section all "app" in main.c

During compilation I'm getting following error:

ltc E112: cannot locate 1 section(s):
ltc I455: requirement: 0x2a bytes of ROM area in space mpe:vtc:linear
ltc I456: section type: absolute restriction - at address 0x8018000
ltc I457: .text.app (56) (0x2a bytes)
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
The

#pragma section all "app"

entry needs to be added to all C source modules wherein you would like to change the section name to ..app

The linker error you face indicates that there is an absolute sections placed in the range wherein you would like to have your .app sections placed too. Looking at the map file should show which section causes the trouble. The linker creates the map file also when a linker error occurs. You can check the Locate Results section in the map file to determine which section(s) are in the region starting at 0x8018000 / 0xA018000.

You can change the LSL file entry to a range instead of using a fixed start address for that group. E.g.:

section_layout :vtc:linear
{
group APPLICATION_CODE_AND_CONST ( ordered, contiguous, run_addr = [0x8018000..0x8019000] )
{
select ".text.app";
select ".rodata.app";
}
}


Then the sections can be located somewhere in the range from 0x8018000 to 0x8019000. If this does not fit you can increase the value for the end address of the range (0x8019000).
0 Likes
User16898
Level 4
Level 4
Now I have about 200+ .c files in my project.
Going through all of them would be risky as I could forget about some files( including iLLD), is there other way to change it ?
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
Yes. If you want to change the names for all files you can use the C compiler option --rename-sections / -R. E.g.

-Rapp

to rename all sections to ..app

Please note that the sections of library functions are not affected by this renaming since this option is not applied when the library modules were built. But it's possible to rebuild the libraries with this option too. This is only possible when the full version of the TASKING TriCore tools is used which includes the makefiles and source files to rebuild the libraries included in the installation.
0 Likes
User16898
Level 4
Level 4
I successfully build program in selected ranges of addresses and generate hex file.
The problem is hex file generate different absolute address :

:0200000480007A (Intel Hex Format)
:20002000FFF...

which mean
write 20 bytes under 0x80000020 address
it should be
write 20 bytes under 0x80018020 address

.map file shows following:
| absolute address | 0xa0018020
and all code is set under correct addresses bigger than 0x80018000.

Why then, hex file creates something different ?
0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
Please note that when you use the start from internal flash the device will always start from address 0xA0000020 (0x80000020). Therefore you need always code at this address .
0 Likes
User16898
Level 4
Level 4
Ok, I find out what happens, as ulrichk
said ILLD libraries are not affected by this section change
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
Maybe you missed a preceding '04' record which changes the upper 4 bytes of the address?

020000048001 (Intel Hex Format)
which sets the upper address word to 0x8001

and a following hex data line like:
:20002000FFF...

would be for the absolute address
0x80010020 then

You can also decide to have the linker create an SREC file instead because this lists the full address before the data entries. That's easier to read.
0 Likes
User16898
Level 4
Level 4
ulrichk wrote:
Yes. If you want to change the names for all files you can use the C compiler option --rename-sections / -R. E.g.

-Rapp

to rename all sections to ..app

Please note that the sections of library functions are not affected by this renaming since this option is not applied when the library modules were built. But it's possible to rebuild the libraries with this option too. This is only possible when the full version of the TASKING TriCore tools is used which includes the makefiles and source files to rebuild the libraries included in the installation.


how full version of TASKING is defined ?
0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
Lukas_G wrote:
Ok, but why then all code is set under this adres not only startup code ?

Not all the code must be under this address, only the startup code (most only a jump to a specific other address).
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
The full version of the TASKING TriCore tools is a commercial product you can use for commercial software development. The AURIX development studio can be used for non-commercial purposes. This are two different products. Also the Eclipse plugins are partly different and make process.
0 Likes
User16898
Level 4
Level 4
I've got comercial wersion, how can I rebuild library functions ?
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
You can create a library project in the Eclipse environment and add all C source files which should be included in that lib to that project and create a library out of this files. This lib can then be added to an Eclipse project.

For the standard C libraries included in the installation of the full version of the TASKING tools you can extract the sources by executing the self extracting files in the ctc\lib\src subfolder. There are makefiles included which are used to rebuild the files in a command line invocation using the amk.exe make tool. E.g. to rebuild the libcs_fpu library for the AURIX (TC1.6.x core) you can navigate to the

\ctc\lib\src\tc16x\libc_fpu\lib

folder and run:

amk -a -j

to rebuild the lib. This is only useful if you change compiler options in the makefile before because otherwise there is no need to rebuild the standard C library.
0 Likes
User16898
Level 4
Level 4
how to create C library project in eclipse ?
i found only solution for java and not for C.

moreover I'm getting following error:
ltc E112: cannot locate 1 section(s):
ltc I455: requirement: 16K (0x4000) bytes of RAM area in space mpe:vtc:linear
ltc I454: section type: unrestricted
ltc I457: heap (14785) (0x4000 bytes)
amk E452: ["makefile" 123/0] target 'janus.elf' returned exit code 1
amk E451: make stopped

how to solve it ?
0 Likes