1 |
578 |
jeremybenn |
//------------------------------------------------------------------------
|
2 |
|
|
// Readme.txt
|
3 |
|
|
//------------------------------------------------------------------------
|
4 |
|
|
This project is configure to get you up and running quickly using
|
5 |
|
|
CodeWarrior with the Freescale MCF52259 board.
|
6 |
|
|
|
7 |
|
|
This project provides full support for the selected board.
|
8 |
|
|
The created project provides Standard IO Support through console and terminal window.
|
9 |
|
|
|
10 |
|
|
Sample code for the following language:
|
11 |
|
|
- C
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
//------------------------------------------------------------------------
|
15 |
|
|
// Memory Maps
|
16 |
|
|
//------------------------------------------------------------------------
|
17 |
|
|
The Hardware has the following memory map:
|
18 |
|
|
|
19 |
|
|
# MCF52259 Derivative Memory map definitions from linker command files:
|
20 |
|
|
# __IPSBAR, __RAMBAR, __RAMBAR_SIZE, __FLASHBAR, __FLASHBAR_SIZE linker
|
21 |
|
|
# symbols must be defined in the linker command file.
|
22 |
|
|
|
23 |
|
|
# Memory Mapped Registers (IPSBAR= 0x40000000)
|
24 |
|
|
___IPSBAR = 0x40000000;
|
25 |
|
|
|
26 |
|
|
# 32 Kbytes Internal SRAM
|
27 |
|
|
___RAMBAR = 0x20000000;
|
28 |
|
|
___RAMBAR_SIZE = 0x00008000;
|
29 |
|
|
|
30 |
|
|
# 512 KByte Internal Flash Memory
|
31 |
|
|
___FLASHBAR = 0x00000000;
|
32 |
|
|
___FLASHBAR_SIZE = 0x00080000;
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
//------------------------------------------------------------------------
|
37 |
|
|
// Project Structure
|
38 |
|
|
//------------------------------------------------------------------------
|
39 |
|
|
The project generated contains various files/groups:
|
40 |
|
|
- readme.txt: information for this project
|
41 |
|
|
- Sources: application source codes, user customizable startup
|
42 |
|
|
code, uart library, exception table
|
43 |
|
|
- Includes: derivative and board header files, ...
|
44 |
|
|
- Libs: runtime and libs
|
45 |
|
|
- Project Settings: linker command files for the different build
|
46 |
|
|
targets, the initialization and memory configuration files for
|
47 |
|
|
the hardware debugging, the common startup code, etc...
|
48 |
|
|
|
49 |
|
|
//------------------------------------------------------------------------
|
50 |
|
|
// Build Targets
|
51 |
|
|
//------------------------------------------------------------------------
|
52 |
|
|
- CONSOLE_INTERNAL_RAM:
|
53 |
|
|
This project target is setup to load and debug code from internal RAM.
|
54 |
|
|
It should be used during your application development.
|
55 |
|
|
The application outputs to the CodeWarrior's console window.
|
56 |
|
|
|
57 |
|
|
- INTERNAL_RAM:
|
58 |
|
|
This project target is setup to load and debug code from internal RAM.
|
59 |
|
|
It should be used during your application development.
|
60 |
|
|
This is the very basic project that outputs to the UART.
|
61 |
|
|
You needs to connect a Terminal Program to see the output.
|
62 |
|
|
|
63 |
|
|
- INTERNAL_FLASH:
|
64 |
|
|
This project target is setup to load and debug code in Internal FLASH.
|
65 |
|
|
This is the very basic project that outputs to the UART. User needs
|
66 |
|
|
to connect the terminal to see the output.
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
===================================================================
|
71 |
|
|
WARNING regarding debugging new project wizard code with CCS-SIM
|
72 |
|
|
===================================================================
|
73 |
|
|
The CCS-SIM is an instruction set simulator, it does not implement
|
74 |
|
|
any peripherals.
|
75 |
|
|
The new project generated by the wizard are using startup code
|
76 |
|
|
performing some hardware peripheral initializations.
|
77 |
|
|
When debugging with the CCS-SIM it might happen that the simulation
|
78 |
|
|
stuck on loop using non implemented peripheral register flag as
|
79 |
|
|
condition (PLL initialization as example).
|
80 |
|
|
In this case, you should either:
|
81 |
|
|
- move the PC to next statement
|
82 |
|
|
- use a skip point
|
83 |
|
|
- define a simulator specific macro which used when define allos you
|
84 |
|
|
to comment out the unwanted code in order to debug with CCS-SIM
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
===================================================================
|
88 |
|
|
WARNING regarding code located in RAM
|
89 |
|
|
===================================================================
|
90 |
|
|
Many possible ColdFire target processors have an external bus, so
|
91 |
|
|
you can use large external RAM devices for debugging applications
|
92 |
|
|
during development. But some processors do not have an external
|
93 |
|
|
bus, so you must accommodate applications in on-chip memory.
|
94 |
|
|
Although this on-chip RAM accommodates this CodeWarrior project,
|
95 |
|
|
it probably is too small for full development of your application.
|
96 |
|
|
Accordingly, for a processor without external bus, you should locate
|
97 |
|
|
your applications in flash memory.
|
98 |
|
|
|
99 |
|
|
//------------------------------------------------------------------------
|
100 |
|
|
// Flashing the code
|
101 |
|
|
//------------------------------------------------------------------------
|
102 |
|
|
1. Select the appropriate project target and build it
|
103 |
|
|
2. Make sure the correct remote connection is selected in the Remote
|
104 |
|
|
Connection debugger panel
|
105 |
|
|
3. In the CodeWarrior IDE menu, select Project > Set Default Project
|
106 |
|
|
and select your project
|
107 |
|
|
4. In the CodeWarrior IDE menu, select Project > Set Default Target
|
108 |
|
|
and select the project target that has the code you want to flash
|
109 |
|
|
5. In the CodeWarrior IDE menu, select Tools > Flash Programmer
|
110 |
|
|
6. Go to the flash programmer Target Configuration panel, click Load
|
111 |
|
|
Settings
|
112 |
|
|
7. Browse to the \cfg sub folder and
|
113 |
|
|
select the flash settings xml file matching your build target
|
114 |
|
|
8. Check that Use Custom Settings checkbox is not selected
|
115 |
|
|
9. Go to the Erase/Blank Check panel, select the All Sectors option and
|
116 |
|
|
click Erase
|
117 |
|
|
10. Go to Program/Verify panel, click Program
|
118 |
|
|
11. Your code should now be flashed
|
119 |
|
|
|
120 |
|
|
//------------------------------------------------------------------------
|
121 |
|
|
// Terminal Settings
|
122 |
|
|
//------------------------------------------------------------------------
|
123 |
|
|
In case the UART is supported, the terminal should be setup with:
|
124 |
|
|
- 19200 bauds,
|
125 |
|
|
- 8 data bits,
|
126 |
|
|
- no parity,
|
127 |
|
|
- 1 stop bit,
|
128 |
|
|
- no flow control.
|
129 |
|
|
|
130 |
|
|
Please check this file in the project.
|
131 |
|
|
|
132 |
|
|
//------------------------------------------------------------------------
|
133 |
|
|
// Getting Started
|
134 |
|
|
//------------------------------------------------------------------------
|
135 |
|
|
To build/debug your project, use the CodeWarrior IDE menu Project > Debug
|
136 |
|
|
or press F5. This will launch the debugger. Press again F5 in the
|
137 |
|
|
debugger (or the CodeWarrior IDE menu Project > Run) to start the
|
138 |
|
|
application. The CodeWarrior IDE menu Project > Break stops the
|
139 |
|
|
application.
|
140 |
|
|
|
141 |
|
|
//------------------------------------------------------------------------
|
142 |
|
|
// Adding your own code
|
143 |
|
|
//------------------------------------------------------------------------
|
144 |
|
|
Once everything is working as expected, you can begin adding your own code
|
145 |
|
|
to the project. Keep in mind that we provide this as an example of how to
|
146 |
|
|
get up and running quickly with CodeWarrior. There are certainly other
|
147 |
|
|
ways to handle interrupts and set up your linker command file. Feel free
|
148 |
|
|
to modify any of the source files provided.
|
149 |
|
|
|
150 |
|
|
//------------------------------------------------------------------------
|
151 |
|
|
// Additional documentation
|
152 |
|
|
//------------------------------------------------------------------------
|
153 |
|
|
Read the online documentation provided. In CodeWarrior IDE menu, select
|
154 |
|
|
Help > CodeWarrior Help.
|
155 |
|
|
|
156 |
|
|
//------------------------------------------------------------------------
|
157 |
|
|
// Contacting Freescale
|
158 |
|
|
//------------------------------------------------------------------------
|
159 |
|
|
For bug reports, technical questions, and suggestions, please use the
|
160 |
|
|
forms installed in the Release_Notes folder.
|