Compiler error - CW10.1 for Kinetis

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler error - CW10.1 for Kinetis

1,191 Views
Contributor II

Not completely sure where to start, so forgive me if this is in the wrong area.

 

I've built a project using the headers and C files from the kinetis example projects folders:

 

Source:

09/10/2011  01:13             3,015 alloc.c
09/10/2011  00:30             5,139 arm_cm4.c
09/10/2011  00:37               702 assert.c
09/10/2011  00:06             1,085 gpio.c
09/10/2011  00:37               655 io.c
09/10/2011  00:40             1,231 main.c
09/10/2011  00:34             9,823 mcg.c
08/10/2011  23:03            20,499 MCUinit.c
08/10/2011  23:03             2,989 MCUinit.h
09/10/2011  00:37             6,694 memtest.c
09/10/2011  00:37            17,116 printf.c
09/10/2011  00:37             2,585 queue.c
09/10/2011  00:37             3,178 startup.c
09/10/2011  00:37             8,187 stdlib.c
09/10/2011  00:38             4,127 uart.c
09/10/2011  00:37             8,254 uif.c
Headers:
09/10/2011  01:13             2,146 arm_cm4.h
09/10/2011  00:37               546 assert.h
09/10/2011  00:35             1,368 common.h
09/10/2011  00:35             1,334 cw.h
08/10/2011  22:56               210 derivative.h
09/10/2011  00:37               423 io.h
09/10/2011  00:34             1,405 k60_tower.h
09/10/2011  01:01             1,214 mcg.h
09/10/2011  00:37             1,128 memtest.h
08/10/2011  22:56           812,262 MK60N512VMD100.h
09/10/2011  00:37               787 queue.h
09/10/2011  00:37               369 startup.h
09/10/2011  00:37             1,121 stdlib.h
09/10/2011  00:38               505 uart.h
09/10/2011  00:37             2,876 uif.h
I'm getting several errors on the compiler:
C:/Program Files (x86)/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwccarm|Compiler|Error(E:\Kinetis Projects\TowerTest\Project_Headers\arm_cm4.h|69|32|1|1448|1)=typedef unsigned long int uint32; /* 32 bits */  >illegal name overloadingC:/Program Files (x86)/Freescale/CW MCU v10.1/MCU/ARM_Tools/Command_Line_Tools/mwccarm|Compiler|Error(E:\Kinetis Projects\TowerTest\Project_Headers\arm_cm4.h|83|25|7|1954|7)=typedef volatile uint32  vuint32; /* 32 bits */  >illegal name overloading
Errors caused tool to abort.C:\Program Files (x86)\Freescale\CW MCU v10.1\gnu\bin\make: *** [Sources/main.obj] Error 1
Looking in the files, the errors are down to typedef declarations for "unsigned long int" and "volatile uint32" both in arm_cm4.h. Also, the set_sys_dividers function is causing the "illegal name overloading" - I can't see this declared anywhere else in my project except mcg.h.
What I'm trying to do is get a basepoint from which to start accessing peripherals such as the uart, GPIO, touch sense etc and so uart.c has required uart.h and common.h, otherwise the functions are declared illegal, and so on, until I've got the files you see above.
I'm using CW10.1, with PnE USB OS JTAG I believe, at least the USB debugger / programmer built into the K60 twr module.
Any suggestions?
Labels (1)
0 Kudos
3 Replies

45 Views
Specialist I

I am not sure what you are doing here. First, let's confirm that nothing is wrong with the tools. Can you build an example project using the CodeWarrior new project wizard and does it work? If not, something's wrong with the CodeWarrior installation. If the project builds and runs fine, then my next question is: how are you building your project? Did you use the wizard to set it up? How are you adding your source code files to the project?

 

---Tom

0 Kudos

45 Views
Contributor II

Fixed - kind of - or maybe irrelevant.

 

My apologies - I'm new to CodeWarrior. So, I went back to basics and built an example project following the steps in the readme.txt. I can build the example projects ok, and I can build / debug / run a project for the kinetis ok from scratch using a wizard.

 

My approach previously, that caused the errors above, was to copy and paste source files and headers as needed, into a fresh project created by the wizard.

 

Basically, no...

 

What I wanted to do was create a fresh project, say, with the intention of communicating over SPI to a sensor, to the serial port (on which I had a USB>serial converter and realterm) or whatever. Basically, I just want to use the headers and create a bare metal app from scratch, using functionality that I'd code myself.

 

Unfortunately, when a file wants to include common.h, then it snowballs to needing half the peripheral support .c +.h files for the board, and that's where I was getting the error above. The example projects compile ok, but what if I want adc AND usb to work together? Or combinations of various functionality.

 

All I was trying to do was skip the example projects and go straight to some home brew coding and get my hands dirty. Instead, seems I got my fingers burnt, lol :smileyvery-happy:

 

I'm used to PIC32MX + MPLAB 8 / X and being able to create C/H files and functionally work from a processor header file to build all the functionality I need. I appreciate it's a bit more complex here. :smileyhappy:

 

So, in essence, what's the best way to go from hello world to a data logger / LCD controller / custom app on a custom board? Apologies for not reading the readme.txt until half a dozen failed project attempts into building from scratch - I just like to know too much how things work!

45 Views
Specialist I

For a CodeWarrior project targeting a Kinetis MCU, you want start with the simple "Hello World" project and open the Project_Headers folder in the CodeWarrior Projects view. There will be a "derivative.h" file that simply references a MCU-specific header file, for example, MK60N512VMD100.h. This header file defines all of the MCU's peripheral ports and the bit-mappings for certain registers. All of the C libraries, at the lowest level, reference this file in some way.

 

For USB and ADC peripherals, you might want to use Processor Expert in the tools to set up drivers for them. Sure, that puts a layer between you and the metal, but it also gives you working code to study.

 

---Tom