Spanish Italian
17436 Users    

Extra Notes for Kirin3 Labs

  Download PDF version of the Article

Freescale offers many documents for its latest connectivity microcontroller Kirin3, MCF52259. I believe most of the people will start to evaluate the labs without reading the documents. I am one of these guys who hate reading documents. However, it is worth to read the document if you have no experience on CodeWarrior and ColdFire.

When I received the Kirin3 demo kit from Freescale, I could not wait any more and started to test the default lab shipped with the kit, the web HVAC project. The project is perfect, as described in another blog (Extra Notes for Kirin3 Labs). It presents an HTTP server with USB host / MSD driver as well as the state of art Web 2.0 design (AJAX).

On the second day, I tried the other labs. During the walk through process, I met some difficulties, which I want to share with you.

Here is the lab list:

  • Lab 1 HVAC Controller, Freescale MQX RTOS for MCF52259
  • Lab 2 USB functionality, Freescale MQX USB and MFS
  • Lab 3 Telnet and FTP Operation, Freescale MQX RTCS
  • Lab 4 Web-Enabled HVAC System, default project
  • Lab 5 Finding an Error Using Task Aware Debugging (TAD) in CodeWarrior
  • Lab 6 Ethernet to Serial Bridge

According to the Quick Start Manual, the regular procedure for each lab is:

  • Open the project file (*.mcp), press the Make button to build the target project.
  • Using Tools | Flash Programmer to invoke the flash programmer, since most projects for MCF2259 run in the internal flash memory.
  • Uncheck the checkbox of Use Custom Settings, and load settings from MCF52259_INTFLASH.xml, in which defines properties of internal flash memory in MCF52259.
  • Erase and blank check the flash memory.
  • Program and verify the code in the flash memory.
  • Hit Debug or Run command in the debugger.

When I tried to reproduce the Lab 3, I ran in an erasing problem, which took forever, so I had to cancel the erase operation as soon as I realized it went wrong. I tried to press the reset button, closed and invoked CW IDE again. Finally, I could erase and program the code. But CW always reports following warning when I try to run the code.

Exception vector name: Bus Error PC where the exception happened: 0x00000418

I have no idea about this warning at all. After checking with the Freescale forum, I found a discussion thread for it. It may be caused by a code placed in wrong place due to link script or other reasons. Maybe I have not erased the flash memory completely and the code is not running as I want. Then I tried to erase the code for several times. I always get this warning message. On the other day, I run CW again, clean and make project again, then I can erase and program the code successfully. So I knew there is something wrong in the programming procedure, since the code has never been touched for single line.

I have no experience on CW+DBM+ColdFire before. But I assume the tool chain should be similar with other popular platforms, such as Keil+JTAG+ARM. In most cases, they are same things with different terminologies. So I spent some time on reading the documents and searching the forum.

In Freescale ColdFire, Metrowerks CodeWarrior is the preferred IDE, including compiler, assembler, linker and debugger front-end. CW can support many software simulator, hardware emulator or debug facilities, including OSBDM for ColdFire. The OSBDM has been mounted on demo kit already, permanently, using PCB wires, rather than the regular plug and socket. Theoretically, after power on reset, even the flash has been programmed a valid program, it can not run immediately, since OSBDM has halted the code from running.  However during my walk through, for some reasons, maybe my fault of improper operation due to no prior reading document, the previous running project can not be halted or re-connected by the OSBDM and CW. So it is still running, which confuses OSBDM and CW. As a result, the following operations for erasing, blank checking, programming and verifying is totally out of order.

All flash operations are performed by the utilities running on ColdFire. You can find following statements in the log file:

Using Algorithm: CFM_MCFCOMMON.elf
Using utility file: FlashUtility.elf

When you request CW to erase the chip, program the code, it will download an elf into RAM to run for requested operation. I still wonder why CW can download the elf into ColdFire RAM while other project is running. Anyway, this chaos is caused by my improper operation procedure. So it is a good practice to stop the running project before any flash memory operations. You may stop the project with different procedures in run and debug modes individually.

Debug and Run

When you press debug button in CW, a debug window will display the stack, source and variables. You can step into, step over, step out, and break and kill debug session. When you quit the debug by closing window, CW also prompts you to kill or resume debug session. Normally, a newbie for CW will not make mistakes. If you press run button in CW, then no debug window will show up, consequently, no prompt to remind you to kill/break the running code. When you close and run CW again, the code still runs. So it is better to remind yourself to break the running code. CW uses the terminology Break, rather than commonly used Stop command in other IDE. Break stands for manual break the microcontroller. The kill command will break the code and close the debug window and session.

How to Stop the Running Code Anyway

In case you run the code and close CW in previous session. You'd better to kill the running code anyway. You can run CW again, then using Debug | Attach to process (which shows up source window) or Debug | Connect (which only shows up disassembly window) command to tell OSBDM/CW to connect the running code and show up a debug window. So you can kill it in the debug window.

I used to doubted if the internal flash memory can bear frequently reprogramming during the development. Finally I draw a conclusion, I have to doubt myself before any other reasons. Here are some other common problems.

Debugger Issues

I am still reading the debugger manual from Freescale to understand the whole tool chain working flow in JM60/OSBDM and CW. I found JM60/OSBDM is for MCF52259DEMOKIT, the evaluation board for MCF52259 is using PEmicro USB on board. That also means the projects have to change their settings for debugger connections in CW, otherwise CW can not connect to the BDM facility on chip.

RAM and Flash

Some projects offer two build target, RAM and flash. In a RAM build project, you can just make the project and start the debug session immediately, without running programming as flash build. If you try to program RAM build to flash memory, you will get an error warning.

Debug and Release

You also can find debug and release build target. I used to consider these build have same meanings for GCC since their output formats are elf. In GCC, debug build stands for an elf includes huge debug information (symbols and etc), and release build removes the debug information with much smaller size. Freescale has different meanings for debug and release builds. According to debugger manual for CW, debug build is a low optimization (level 1) build to makes debug easier, release build is a highly optimized build (level 4) to make it run faster. Either builds have no debug information in the file. 

Network Issues

In network labs, I manually set 169.254.3.30 to my PC. However, I can not ping Web HVAC server from PC and the other way either. I am quite confused because I have successfully setup Lab 4 when I got the kit. I have two Ethernet connections, one links to demo kit, the other WiFi links to my Wireless router to keep me online. When I disable the WiFi connection, I also get Ethernet communication to the demo kit. As result, please double check your network setup when you reproduce the TCP/IP related labs.

There is also another problem without any clue. In Lab 4, when I use Microsoft FTP to list and download the log file form demo kit, the operation is timeout. However when I use FireFTP in Firefox, it runs so well. I downloaded the whole USB directory to my local folders, and then upload a big image file to the demo kit. The download link speed is 3KBps and upload link speed is 6KBps. Although in the document, ftp in Windows XP is preferred ftp client, but it never works for me. Maybe I have banned the microsoft FTP before.

CONTACT REQUEST
If you want to know more about this Freescale product, please submit your request to Arrow Italy using this form.

NOTE: this form is valid ONLY for Companies or Customers based in Italy and working in the Italian area.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Who's new

  • pulper
  • mauriss
  • jbares
  • christiank79
  • agabor
  • fabriziopd
  • irenix
  • pepershoe
  • raghun14
  • andreaspousette

Who's online

There are currently 0 users and 43 guests online.