Setting CodeWarrior Startup file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting CodeWarrior Startup file

2,405 Views
prog_ram
Contributor III
Hello guys,
I have recently started using the CodeWarrior IDE after couple of years of using COSMIC IDE.
CodeWarrior looks really good and complete.
But I need your help getting me started here.

(1)
I downloaded the free special version to work on MC9S12DP512 MCU and I ran the demo that comes with it. The demo started working immediately in the simulator software. I looked in the code to find where the clock speed and PLL and COP settings are configured, but I couldn't find it. The Startup.c file has some #ifdef statements in the _Startup procedure, but I couldn't find where exactly the CRG stuff (clock,pll etc) are configured.
(2)
in the Startup.c file, I also found two options to configure the _Starupt routine (also there are the #ifdef statements), but again, couldn't find where they are set..
in simple words,
#ifdef (something) then
#def (this thing)
end
Where this (something) is defined?!

Thanks a lot..
Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

762 Views
CrasyCat
Specialist III
Hello
 
Basically if you have created a project with Processor Expert , the PLL and COP are initialized in the function PE_low_level_init(), which is implemented in cpu.c.
 
If you did create your application without ProcessorExpert, PLL is not initialized. COP is initialized according to macro _DO_ENABLE_COP_, _DO_DISABLE_COP_.
These macros are defined on the Compiler command line:
 To check your command line:
  - Open your project in CodeWarrior
  - Open target Settings dialog (Press ALT + F7)
  - Switch to Compiler for HC12 Panel
You can see the compiler command line arguments in there.
 
CrasyCat

762 Views
stanish
NXP Employee
NXP Employee
prog_ram,

1) in fact the default CodeWarrior startup code doesn't touch PLL registers.  Anyway you can modify the startup (file start12.c from your project directory) in order to initialize PLL prior to startup routine (copydown,..) or you can init PLL at the beginning of the main().

Note: Processor Expert project initialize PLL prior to startup code execution by default (_EntryPoint() function)

Regarding COP: there are several macros described in startup12.c:

Code:
/***************************************************************************//* Macros to control how the startup code handles the COP:                 *//* #define _DO_FEED_COP_  : do feed the COP                                *//* #define _DO_ENABLE_COP_: do enable the COP                              *//* #define _DO_DISABLE_COP_: disable the COP                               *//* Without defining any of these, the startup code does NOT handle the COP *//***************************************************************************/

 You can define a macro either directly in startup12.c or pass macro via project settings "Compiler for HC12" -> "Command Line Arguments" -> add "-Dx" where x is macro name. e.g.: "-D_DO_ENABLE_COP_" to enable COP.

2) There are several #ifdef statements in start12. Most macros are generated by the compiler based on compiler/project settings. (e.g. memory model, startup type, optimization  type....). In order to change the default startup you can define some macros described at the beginning of the start12.c.
Usually these definitions are available in the compiler settings panel  "Compiler for HC12" -> "Command Line Arguments" -> arguments with prefix -D and they are generated by Project Wizard when project is created.

Stanish