Free (open-source) IDE, toolchain and visual debugger for MCF5282

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

Free (open-source) IDE, toolchain and visual debugger for MCF5282

7,314 Views
mccPaul
Contributor I
Having spent several weeks trying to get a working development system for mcf5282 based products (5282Lite and the EMAC SoM5282 module) I have finally got a system that mostly exceeds my expectations.
 
As I found it difficult to find out how to go about setting up a toolchain I thought that I would share my experiences.
 
I tried several toolchains, commercial and non-commercial before settling on the Eclipse IDE, CodeSourcery GNU toolchain and Zylin Eclipse CDT extensions, all combined with SubVersion for source control. As long as you have a workstation with a decent amount of memory (1GB+) and fast enough (2GHz+) the Eclipse IDE is very good. The Zylin extensions mean that I can debug using a P&E cable (parallel and USB) and that the debugging is entirely visual.
 
To save repeating myself, this link is to my posting on the Zylin mailing list that explains how to set up the system: http://zylin.com/pipermail/zylin-discuss_zylin.com/2006-August/000294.html
 
I'm happy to answer questions on this, but please note - I know next to nothing about Linux. You will be able to set this up on a Linux system but my system is Win XP hosted with no CygWin or MinGW in sight.
 
It would be interesting to see if this can be made to work with the open source TBCLF BDM cable mentioned in the sticky at the top of this forum.
 
When I said mostly exceeds my expectations, the problems are: occasionally GDB hangs, but I can blame my poor code for some of that and it is not really a big issue. Eclipse is a bit of a memory and CPU hog, but for all that you can tell it has a professional pedigree and it will run on most platforms. I wish I could use managed make, instead of writing makefiles by hand - somehow this seems like a task perfectly suited to a computer!
 
 
 
Labels (1)
0 Kudos
9 Replies

1,351 Views
mccPaul
Contributor I

I have eventually got round to creating a proper set of instructions that will show you how to set up a very professional development system for ColdFire, with a sample application to get you started.

The instructions are for a Windows XP hosted system, but if you are Linux friendly you may be able to translate the instructions. All of the software is available for Windows and Linux.

The Eclipse IDE is a fantastic application that can be used for all sorts of development languages. It integrates very well with source control and issue tracking software to create a development platform that rivals many commercially available systems.

The instructions are on my website:

http://www.cambridgeimaging.co.uk/whitepapers.php

Enjoy!

Paul.

0 Kudos

1,351 Views
Piotr
Contributor I
Hi,
I would like to share my experiences with the IDE toolchain described by Paul (thanks !!).
My hardware is 5485Evb board and parallel version of P&E device.
I had only minor problems setting CodeSourcery + Eclipse.
Project Yagarto (http://www.yagarto.de/) has very useful information about similar project regarding ARM CPU.
I created and compiled simple hello.c using standard m5485evb-rom-hosted.ld
Unfortunately running debug sesson was a nightmare. First problem was installing P&E drivers. I was never able to get anything more then "error:Could not load P&E DLL" message. Fortunately CodeSourcery 4.1.30 just arrived, with a new stub (now the name is m68k-elf-sprite.exe) and P&E drivers included. That installed flawlessly.
Even then starting gdb session was not succesful. A number of 'Communication error: No error' messages was displayed (in verbose mode) on the console, which was not very useful :smileysad:
I am new to the gdb, so that was rather frustrating. I spent a lot of time discovering the source of the problem.
Finally I tracked the problem to the uninitialized %sp register. The .xml files supposed to initialize the CPU do not set %sp. The first command Eclipse sends to GDB after 'load' is -stack-list-frames. GDB tries to access (%sp), which is usually out of physical memory, which in turn hangs CPU and BDM communication.
%sp is initialized as first command of crt0, but it is too late...
As a quick fix I expanded my initialize commands:
target remote | m68k-elf-sprite pe://ParallelPortCable:1 m5485evb
load
set $sp=0x4000000
I am still not sure how this should be done properly, but at least I have working debugger :smileyhappy:
Any comments are welcome,

Piotr
0 Kudos

1,351 Views
oed
Contributor I
PLEASE PLEASE HELP ME !!!!!!!!!!!!!!!!!!!!!!!!

We are using eclipse 3.2 with Zylin and CodeSourcery GNU Toolchains using as target the M5213EVB with the PEMICRO_USB_MULTILINK. We are using this in 'initialize commands':

target remote | m68k-elf-cfpe-stub -d USBMultilink -t m5213evb -s 10
load

We are getting the .elf for debugging, but we got error when we call the gbd. We connet with the gdb, but when we resume the applicaton we got the following message "Execution is suspended because of error. Don't know how to run. Try "help target".

Could some one help me for using the eclipse 3.2,CodeSourcery, and the gdb to produce applications for the M5213EVB.
0 Kudos

1,351 Views
mccPaul
Contributor I
I suspect that you require more setup than just setting the target to the remote gdb stub. The -t m5213evb should set up GDB for your board, but it may work better if you create a script yourself.
 
I have no knowledge of your board, but I have had the same kind of problems with a 5282 based board similar to the Freescale 5282Lite board. I am writing my own startup code and I kept on getting the same sort of errors as you until I made a script up to set up the board to the correct memory map. I had loads of problems, until I realised that I needed to do this, and even then I still had problems until I realised that my external flash boot set up meant that half the external address bus was being used as GPIO so I could access SDRAM properly.
 
This is my script for the 5282:
 
Code:
target remote | m68k-elf-cfpe-stub -d USBMultilink# -t m5282evbset $myipsbar = 0x40000000# GPIOset $mypbcdpar = $myipsbar + 0x100050    set *(unsigned char *)$mypbcdpar=0xC0# SRAMset $myrambar = $myipsbar + 0x008    set *$myrambar = 0x20000021# External flashset $mycs0_csar   = $myipsbar + 0x80    set $mycs0_csmr   = $myipsbar + 0x84    set $mycs0_cscr   = $myipsbar + 0x8A    set *(unsigned short *)$mycs0_csar=0xFFE0set *(unsigned short *)$mycs0_cscr=0x1980set *(unsigned long *) $mycs0_csmr=0x001f0001# Disable Watchdog Timer Module (WTM)#set $wcr = $myipsbar + 0x140000#set *(unsigned short *)$wcr=0x0000# SDRAMset $mysdramc_dcr     = $myipsbar + 0x40    set $mysdramc_dacr0   = $myipsbar + 0x48set $mysdramc_dmr0    = $myipsbar + 0x4Cdefine waitset $foo = 0while ($foo < 20000) set $foo += 1endendset *(unsigned short *)$mysdramc_dcr = 0x023cset * $mysdramc_dacr0 = 0x00001300set * $mysdramc_dmr0 = 0x00fc0001set * $mysdramc_dacr0 |= (0x00000008)  # init prechargeset *(0x00000000) = 0xDEADBEEF# waitwait# set RE  in dacrset * $mysdramc_dacr0 |= (0x00008000)     # issue IMRSset * $mysdramc_dacr0 |= (0x00000040)   # wait for 8 auto refreshwait   # set modeset *(0x00000000 + 0x400 ) = 0xCAFEBABE

 
To use it outside Eclipse, just put the script in the same directory as your .elf file, and type:
 
gdb-m68k-elf script.gdb
 
Where script.gdb is the script file. When you have gdb running, you can load your .elf file, set $pc=start (or whatever your start address is and run your code.
 
If that doesn't work, use gdb commands to examine and modify the RAM that you think your code is loaded into - also I have assumed that you don't have a boot loader in flash that is changing anything.
 
Once you can debug OK in GDB, you should find that Eclipse is OK, but you will have to put the script into the Eclipse debug initialize commands.
 
Paul.
 
0 Kudos

1,351 Views
Mikerider
Contributor II

Can some one give me some information about the quality/size of the code (.s19) generated by the m68k-elf-gcc vs the generated by the codewarrior?.

0 Kudos

1,351 Views
krishnan
Contributor I
hi

I'm in the process of figuring out how to use the Eclipse IDE and the GNU toolchain from CodeSourcery for my project concerning a MCF5282, belonging to the coldfire family.

I'm following instructions from the following links for the same.

http://zylin.com/pipermail/zylin-discuss_zylin.com/2006-August/000294.html

I have set my entire system up as per the instrucions on this link.

I however have some doubts, that I need clarification on :

1. Do i need to write a linker script / command File with every Project ???
2. Is there like an automatic makefile generator available for ColdFire that will generate these linker scripts and makefiles??

regards

techie
0 Kudos

1,351 Views
mccPaul
Contributor I

The manage make in eclipse would, in theory, manage makefiles for your project as long as it understood how to call your build tools. Unfortunately, embedded projects usually vary dramatically between platforms and even within platforms. This means that someone has to customise the IDE so that it can manage projects for the platform you are working on.

The commercial IDEs do this - e.g. CodeWarrior and so do the commercial distributions of eclipse - see CodeSourcery for a good example.

If you are trying to create a toolchain and IDE from open source distributions then you generally have to write your own makefiles and linker scripts. The problem you have then is that the examples that you can find are usually far too complex to understand or far too simple to be useful.

Once you have your own makefile and linker script for a project it is not too difficult to tweak them for new projects - mostly you will just cut and paste your source file paths. I am currently working on a simple app that will relocate from flash to SDRAM and execute a simple hello world. If I can make sure there are no copyright issues with the FreeScale startup code I will post a link here for it.

However, the code will be designed for my board, which is similar but not identical to the 5282Lite. You will probably need to do some customisation yourself.

Paul.

0 Kudos

1,351 Views
krishnan
Contributor I


mccp wrote:

The manage make in eclipse would, in theory, manage makefiles for your project as long as it understood how to call your build tools. Unfortunately, embedded projects usually vary dramatically between platforms and even within platforms. This means that someone has to customise the IDE so that it can manage projects for the platform you are working on.

The commercial IDEs do this - e.g. CodeWarrior and so do the commercial distributions of eclipse - see CodeSourcery for a good example.

If you are trying to create a toolchain and IDE from open source distributions then you generally have to write your own makefiles and linker scripts. The problem you have then is that the examples that you can find are usually far too complex to understand or far too simple to be useful.

Once you have your own makefile and linker script for a project it is not too difficult to tweak them for new projects - mostly you will just cut and paste your source file paths. I am currently working on a simple app that will relocate from flash to SDRAM and execute a simple hello world. If I can make sure there are no copyright issues with the FreeScale startup code I will post a link here for it.

However, the code will be designed for my board, which is similar but not identical to the 5282Lite. You will probably need to do some customisation yourself.

Paul.




hi Paul

Kindly let me know how you go with that...

At least it will serve the purpose, by giving me some ideas of where to start with!!

Hope to hear from you soon.
0 Kudos

1,351 Views
krishnan
Contributor I
hello Paul

I'm trying to start of with the ColdFire architecture. To begin with, I want to set up the Eclipse-ZylinCDT toolchain with the cross - compiler from CodeSourcery.

As you would have observed from my previous postings, am very new to this domain. Will appreciate if you can give me a step by step HOW TO of how to set up the entire toolchain.

Also, have you run any sample projects ??? If yes, would you mind passing them on to me. Atleast that would help me get started.

Thanks and regards

Krishnan.
0 Kudos