Embedded Software

From ELC Wiki
Jump to: navigation, search

Required Packages

Once you get to the stage where you want to program your the ELC firmware there are two options. Either you can use one of the pre-compiled binaries which can be downloaded to the FRDM-KL26Z board using a flash programming application or you can build your own binary from source using the code provided. The latter option will require you to set up a development environment.

If you just want to use one of the pre-compiled binaries you still need to install the Segger or PEMicro drivers and you'll need Git to acquire the binary ".srec" files.

Development environment for ARM

The code for Bluebird ELC was developed using Atollic Truestudio which is a fully featured free IDE for code development in C/C++. It can be downloaded from their website:

The source code repositories contain project files for use with Atollic which therefore makes it the easiest way to start modifying the code. If you're a more experienced user you can configure your own preferred development environment.

Git and Tortoise Git

All the source code is controlled using Git, which is used to track changes and releases. Git can be downloaded for free from their website:

Git is the underlying source control system that can be operated using the command line, however a there are several 3rd party graphical user interfaces that can be installed to make usage a bit more friendly. A good one is TortoiseGit which can be downloaded from here:

A tutorial on basic Git usage can be found here.

Segger and PEMicro

The FRDM-KL26Z evaluation board comes with an on-board tool which can be programmed with firmware compatible with the Segger J-Link or PEMicro toolsets. The Atollic project is configured for use with the J-Link driver but this can be easily changed. Both of these drivers should be installed with Atollic Truestudio but additional tools can be downloaded from Segger and PEMicro websites.

Get the software

Visit the software page to clone the source code repository or download pre-compiled binaries.

Programming the FRDM-KL26 Board

On-Board Debug Tool

The first time you open a new FRDM-KL26Z evaluation board you will need to upgrade the firmware in the on-board debugger. This only needs to be done once for each new FRDM-KL26 board.

It appears this process can be done on Windows 10 using "safe mode". Previously it seemed that only Windows 7, Vista and XP machines could carry out the debug tool firmware upgrade procedure.

Entering safe mode on Windows 10

  1. Go to the "Settings" Menu
  2. Choose "Update & Security"
  3. Choose "Recovery" from the menu.
  4. Click "Restart Now" under the "Advanced Startup" heading. Note that this will restart your computer.
  5. Once your PC restarts, you'll need to choose "Safe Mode" from the menu. (Option 4).

Debug Tool Firmware Upgrade

On Windows 10 in "safe mode", or on any Windows 7, Vista or XP machine, even without the Segger or PEMicro drivers installed, the following procedure can be used. Download the PEMicro OpenSDA firmware files here.

  1. Holding the reset button on the evaluation board, connect the OpenSDA USB socket to the PC, then release the reset button
  2. A disk drive named "Bootloader" should appear like a removable flash drive.
  3. Copy the J-Link OpenSDA firmware file to the "Bootloader" disk.
  4. Safely remove the drive as you normally would a USB flash drive.

To Confirm the upgrade

  1. Connect the device to the PC you plan to use for programming with the Segger or PEMicro drivers installed, again using the OpenSDA USB socket.
  2. In device manager, the device should enumerate as j-link driver under USB devices
  3. If you're using Windows 10 in safe mode, you may now restart your PC to return to normal mode.

Programming the ELC Firmware into the KL26Z Microcontroller

It is recommended that you program the ELC firmware into the FRDM-KL26Z evaluation board the first time before it is installed on the ELC control board as an extra precaution. After the ELC firmware has been programmed once, it can be left installed on the control board for future programming iterations. This is to make sure that the firmware loaded is "known" and configures the microcontroller pins in a predictable way when the board powers-up.

Using J-Flash Lite

The result of building the source code is a binary program file which can be loaded into the KL26Z microcontroller. There are pre-compiled binaries available or you can build your own custom ones. The binary file should be in the ".srec" format. Once you have the ".srec" file you want to load into the microcontroller, you can use the following procedure:

  1. Connect the KL26Z Evaluation board to the PC using the OpenSDA USB socket
  2. Open J-Flash Lite
  3. Select the appropriate microcontroller (NXP MKL26Z128XXX4) from the list
  4. Choose, "SWD" interface, and speed "1000"
  5. Click "OK"
  6. Click the button in the "Data File" section and browse to the ".srec" file you want to program
  7. Click "Program Device"