Hi,
I am using codewarrior for freescale MPC55XX version 2.4 and IDE version is 5.9.0
My processor is MPC5634.
My question is:
-do we need all the startup code listed in the wizard project such as MPC5633M_HWInit.c MPC55XX_init_debug.c MPC55XX_init.c?
-do we need use files in installDir\ PowerPC_EABI_Support\ Runtime\src( such __start.c and _mem.c etc. )as our startup code? If not ,where is the software entry poit function(_start())?
Hello Julia,
1) CodeWarrior startup includes Exception and INTC controller init, SRAM init,.... the routines are spread into several files (e.g. MPC55XX_init.c contains the RCHW and reset vector configuration). If you remove some file you may not be able to compile your project because of the dependences. If you use your own startup you can remove these .c and .h files from the project.
2) Entry point function "__start()" is the part of the standard runtime library (e.g. Runtime.PPCEABI.VS.UC.a ) which is added into project by Wizard together with ANSI C/C++ library (e.g. MSL_C.PPCEABI.bare.VS.UC.a). Therefore you don't need to add any .c and .h source files from "installDir\ PowerPC_EABI_Support\ Runtime\src"
If you need to do some modifications to the startup code from the runtime library you can copy the related .c files from CW directory into your project source directory, add them into project, edit and compile.
Linker should use the source file instead of library then. (see generated .map file for more info)
Note: I'd suggest you to download the latest CodeWarrior v2.7 available here:
Stanish
Pasted from <http://forums.freescale.com/t5/forums/replypage/board-id/CWCOMM/message-id/7609>
hi,
thanks for your reply! and good thanksgiving day.
I want describe my problem in detail:
for some reasons our projet need the _start() function must start from address 0x10000 in map file .
So i add the _start.c into my projet and describe the '.init' section LOAD from 0x10000 in the LCF, and after compile the _start() function 's address is 0x10000 in map file and software runs well . which couldn't be made succeed if i just use the library in installDir\PowerPC_EABI_Support\Runtime\Lib to compile.
But the problem occurs again because we need compile the project into .a library .
if i add the _start.c into my projet ,compile couldn't succeed for some link error . which could be made succeed if i just use the library in installDir\PowerPC_EABI_Support\Runtime\Lib to compile but in this way ,the _start() is not in 0x10000.
so my question is how to make a succeed compile(compile result is .a library) and the _start() address is 0x10000
Hi julia
In case you use would like to create a library that includes startup I'd suggest you to copy & add startup source files into your project from CodeWarrior source directory ("<CW for MPC55xx and MPC56xx 2.x>\PowerPC_EABI_Support\Runtime\Src\" ) e.g:
__start.c
__mem.c
__init_cpp_exceptions.cpp
ExceptionPPC.cpp
and remove the runtime library. Otherwise your created library will contain all the objects from the runtime library,
In order to make sure __start() function is always at specific address I'd suggest you to place __start() it into separate linker section using pragma e.g.:
__start.c
------------
...
#pragma push
#pragma section code_type ".abs.00010000" code_mode=pc_rel
extern void __start(int argc, char **argv, char **envp); /* primary entry point */
#pragma pop
...
Then you create a library.
If you need to use the library in a project you just have to define a new section in the linker command file:
MEMORY
{
..
startup : org = 0x000010000, len = 0x00000100
...
}
SECTIONS
{
...
.abs.00001000 LOAD (0x00010000): {} >startup
...
}
Hope it will help
Stanish
hi,
sorry,i don't want to know how to link the _Start() at 0x10000, because i have succeed as i said in the lately reply.
My problem is:
if i add the _start.c into my projet ,compile couldn't succeed for some link error when we compile the project into .a library .
thanks a lot.
Hi julia,
could you perhaps post the linker errors you get?
Thanks.
Stanish
hi,
error messages is in the attachment