Coldfire: I totally don't get this

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

Coldfire: I totally don't get this

3,300 Views
DanielMorley
Contributor I
I am new to the field and I am trying to program a board. Pardon me if this is a stupid question.  I have looked at the example code that freescale has provided and allot of the source files are largely blank.  They will have a lengthy description but in the main file I find nothing but the intial code in most  cases.  Can someone explain what that is the case. Is the code writen in a support file that is not included or what.  

Message Edited by CrasyCat on 2007-04-13 11:17 AM

Labels (1)
0 Kudos
7 Replies

466 Views
DanielMorley
Contributor I
I was just refering to the fact that most of the example programs that I look at from the freescale website have no code in the main .c or cpp file.  I was curious if the code is elsewhere like in a header.  In some cases there is a page of comments but when you look at the main file there is nothing but the main program with a watch dog loop in it. 
0 Kudos

466 Views
admin
Specialist II


Daniel Morley wrote:
I was just refering to the fact that most of the example programs that I look at from the freescale website have no code in the main .c or cpp file. I was curious if the code is elsewhere like in a header. In some cases there is a page of comments but when you look at the main file there is nothing but the main program with a watch dog loop in it.





I think, that's because some programs developed to work with events - peripheral (timer, ADC, PWM, communication) and MCU-core interrupts. Code described work with peripheral and events can be located in separate files - user modules (.c, .cpp, .asm - files). So main file can be empty.
0 Kudos

466 Views
PopsStack
Contributor I
Hi joerg
 
When installing the CodeWarrior Dev Software, the Quick Guide shows how to get MyProj up a ntrucking - that is the easy part. I got all that going and then went on to declaring as extern the two function calls for the LED's. That was also relatively simple (well not for my brain - took a few hours of fiddling).
 
I saw a statemtn somewhere during this whole process that indicates that when the build is done a whole suite of functions are produced which assist the developer in getting going quicker. I notice there is a lot of source code with Exception Handlers and IO routines etc, with some assembler calls. It also appears that the Vector Table is moved to a new IPSBAR address. There is also a function for initiliasing the MCF5xxxx. I have tried to incorporate this function call and then implement a simple printf function within the Switrch Handler. I cannot get any joy out of this.
 
Is there a specfic order of events that one must follow once the project has been generated/built in order to use these functions so that I can then start configuring/working with other systems on the dev board such as timers and use the interrupt vectors.
 
Any ideas - many thanks.
 
0 Kudos

466 Views
J2MEJediMaster
Specialist I
I assume you're trying to add for functions to one of the simple demo programs. Is this correct? If you want to add capabilities such as printf(), you need to start with a project that does some C run-time initialization and includes the libraries. Try running thriugh the New Project wizard and do NOT configure the project for minimal setup. Make sure the ansi libraries are part of the project.
 
For sensing switches and the like, you're going to read carefully the EVB board's documentation, which should have come with the board. Or you can search the web site for it. The doc explains what ports the switches are tied to, so that you can then use the processor manual and the Codewarrior header files to track down the addresses you need. Conversely, if some of the functions you're interested in appear as light blue in the Codewarrrio editor, you can right-click on them and choose Find this declaration... The editor will take you to the source or header file with the declaration/defintion. Try this with the LED funcitons, which I think are actually macros in this case. Use this fesature to work your way through the various header files, which will give you a feel for where the processor and peripheral reigster declarations reside. HTH,
 
---Tom
0 Kudos

466 Views
PopsStack
Contributor I
This may be similar to what I am going through. I have used Stationery to get a project going. This all ends up in the wonderful "Hello world" output. I can see all the code that I need to use for the Interrupts for the switches on the development board etc but cannot fathom out how to integrate these to use them. The LEDs are fine - by simply making calls to those functions but I cannot get the functions to handle the switches called.
 
Any ideas?
0 Kudos

466 Views
joerg
Contributor II
Hi
Could you two specify exactly what you will program? (Board, MPU, etc.)

Saluti Joerg
0 Kudos

466 Views
tmyint
Contributor I
Hi Dan & Pops,

Sometimes, the example codes are in the freescale folder itself. Look in the directory where u installed it... depending on the CW version, in the subfolder of a freescale folder, it will usually be under

ProcessorExpert\Projects\Test projects

But even the sample projects here missing the code in the main file. Like you said there is only an init() with no code. But there are some files here that I think will be helpful.

Thet
0 Kudos