Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

porting a C program, the ARM7 to Cortex-M3

Status
Not open for further replies.

rmedeiros

Newbie level 2
Joined
Oct 12, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,293
I'm working on a project and i need 2 thinks. I'm a new firmware programmer, and really need help.
1- I have a complete program written and compiled in "C", compiled on keil. It is possible, and easy, port my program to CORTEX-M3?
2- Do you have a good tutorial about programing and compiling on keil for CORTEX-M3? i need something for starters programmers.

very thanks
 

rmedeiros said:
1- I have a complete program written and compiled in "C", compiled on keil. It is possible, and easy, port my program to CORTEX-M3?

It is possible, this is the power of C. If this complete program is well structured and organized, then the only thing you should care about, is the low level routines (ports, timers, A/D etc). However, if peripherals handling from higher level routines is invoved, then you should find these spots and change them too. If you succesfully edit and debug the code, you secured your new project and you can start upgrating. Hardware routines first (since your new controller is better than your old one I guess) and the last part (if you believe it is necessary which I believe it is), is to optimize the code. You will read and find out what is the effective C programming way for this architecture and will edit your code accordingly. So the answer is, edit the low level succesfully and the hard work is done.

Hope this helps.
 
Last edited:
rmedeiros said:
I mean, i'm a starter programmer! :D

Either way it is easier to edit the existing project than write a new one from the scratch.;-)

First of all you must design a new board, with similar functionality with the old board. If for instance an I2C real time clock is used, make sure that this clock will be connected on Cortex's I2C as well.

What you could then do is start digging the project and find out which peripherals are used. Then having your datasheet as your ally, start writing demo programms for those parts. You will also need a good book on Cortex-M3, together with a book on C (preferably for engineers). Internet references through google search are also useful.

Since you write a peripheral's demo routine, get in the project again and figure out the settings used like peripheral speed (for this you will need the old MCU's datasheet as well). Now comes the hard part, you must assemble the project. You start a new project and replace the hardware related code with yours. It may sound scaring, but until you reach this point you will have learned a lot about your new MCU and it will look a bit easier. Or you could do it the other way, that is setup a project of yours with all necessary peripherals working, and plug the high level routines of the other project into yours.

When time comes that no compiler errors are seen, the debugging part comes into play. You must verify that the project's behaviour is the same and fix all bugs that gets in the way. But first of all, gather (write or find) demo projects of your MCU peripherals and you did a solid start!

About Cortex-M3, here are a few references to start with.


https://www.eecs.umich.edu/~prabal/teaching/eecs373-f11/readings/ARM-Cortex-M3-TRM-v2.1.pdf


Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top