October 28, 2014

Announcement - Moving this blog to github pages (0xc0170.github.io)

I decided to move this blog to github. I was playing last 3 days with jekyll. It was harder than I expected, but I have moved all posts there. I'll keep this alive for cross-reference, but will be publishing new posts there.

Comments are enabled for all posts, so if you got any question, follow the link below.

The link My new personal webpage [http://0xc0170.github.io/]

September 18, 2014

Project generator - building exported project

The build feature has been implemented in the last 2 days aka ProjectBuilder. This allows to build exported projects, which is useful for automated testing.

The building is currently supported for all tools there (IAR, uVision, Makefile), but IAR still has one bug, does not generate any output eventhough builds without errors.

Want to share with you, that I am currently adding CoIDE (only export, as it does not support building via command line). Should be completed this week.

Anyone out there using the project generator? What tool would you like to see there ? Eclipse? LPCExpresso? Kinetis Design Studio?

The real example is here https://github.com/0xc0170/project_generator_mbed_examples, using mbed SDK. I replaced mbed library by mbed SDK submodule, to stay up to date.
The example repository shows how are records written and how to use it with your own files (blinky demo).

August 29, 2014

Project generator - wiki pages on github

I am currently writing wiki pages for the project generator. If you are interested in the project, read it and provide feedback.
The link Project generator - Wiki pages [github.com/0xc0170/project_generator/wiki]

I am going to merge IAR options once I finish and test them, currently implementation on the branch. It takes longer time than uVision, as IAR has many separate options.
I finished the release of v0.1 this week, created a new tasks for v0.2.

My focus in the v0.2 will be on documentation, stabilize uVision, IAR and creating one generic Makefile for GCC toolchains.

August 19, 2014

Project generator - gcc arm makefile and IAR enabled (update)

I just want to share that I added 2 more IDE to the project generator.

GCC ARM export and IAR is now enabled.

  • GCC ARM generates a makefile based project. Enabled in the mbed example as well.
  • IAR generates a project. Specific IAR options are not yet implemented. Thus they are predefined in the template project. As I shown with uvision class, it can be added to misc dictionary, and then parse it to get each specific settings.
The example with mbed sources is defined for 2 target at the moment, K20 and LPC1768.

August 12, 2014

Project generators in python for various IDE (uvision at the moment only)

It's been a while I posted something. I reallocated myself and started a new job, as you could notice, thus I didn't have time to write more news. I can ensure you, there are more things I'll be sharing. Let's begin with the one I have been programming last days.

There was a discussion for quite a while about creating exporters for small projects. A generator which could be easily edited and ported to a new platform or a new project. Many projects have own exporters (stay with a term: project generators), but don't share it with the world.

As some of you might have noticed, there were a problem with projects in CMSIS-DAP mbed repository. Projects are tracked by the version control system, as there are no generators. This introduces some clatter to the project, as IDE updates it's project files, without even changing any settings. Then a user sends a pull request with unintentionally updated project files. Not to mention if for a project there are more targets with various settings, the maintenance becomes cumbersome. What if you change a name of common file? Yes, update all projects which are using it.

I decided to give a shot to write trivial project generators in python based on yaml records. I published them few days ago, but there was no example how use records for a project. Therefore there was published an example for project generators. It is for K20D50M target, blinky demo based on mbed sources:

Project generator - mbed examples [https://github.com/0xc0170]
 Currently, project generators support K20D50M target and uvision IDE. There is GCC class but needs more work (planned for upcoming days).

Be aware, it's still in early stage, so the structure of records is subject to change. I published it, primary as I don't have that much free time to be able to expand it dozen of targets and IDE's, therefore I hope that publishing it and providing an example how it works, will attract more developers.
Do you have a project where you could benefit from exporting to various IDE? Give it a try.

April 8, 2014

New FRDM board on mbed with ethernet (news)

I haven't written any blog lately. The reason (for some it can be an excuse) is that I have been porting the new target to the mbed. It's FRDM-K64F which has been announced during FTF 2014.

The link to the platform page to get more information  : FRDM-K64F
The mbed ethernet support is not yet ready, will be available soon.


February 22, 2014

FRDM KL05Z is mbed enabled (news)

The FRDM-KL05Z board was my first target added to mbed. I would even say that was my initial experience with mbed sources. That was back in June 2013. It was added to mbed.org yesterday. This became 3rd Freescale board available on mbed.

FRDM-KL05Z [mbed.org/platforms]

It supports export to ARM GCC, uVision and CoIDE.

Paul Staron shared an info about low power modes and his power measurements. Not possible to carry out on FRDM board though. Here's a link for more information FRDM-KL05Z sleep modes and RTC [mbed.org/forum]

February 17, 2014

CoIDE export is available for KL25Z on mbed (news)

My latest article was how to use CoIDE with C++. I added exporters for CoIDE to mbed. I was able to make it work for KL25Z, KL05Z (not yet online on mbed.org site, will be soon). LCP1768 is functional but not through CMSIS-DAP, due to a problem which was reported to CoIDE team a while ago.

The exporter is online in the mbed compiler, see picture below.

Enjoy using CooCox CoIDE with KL25Z and mbed! If there are any problems, please report them on the mbed site, or just here in comments.

January 27, 2014

CoIDE fix for using C++

Frank V. reported an issue with linking C++ libraries which I confirmed. I just issued a new pull request for mbed exporters with the fix. In case you followed my last tutorial for CoIDE & mbed, this might be helpful.

The problem was that CoIDE completely ignored c++ libraries in the Misc controls for LINK. To surpass this issue, you have to add libraries to the Linked Libraries. Add there the libraries (type there names):

If you prefer to change it directly in the xml (coproj file), add this to already created project:
          <Libset dir="" libs="mbed"/>
          <Libset dir="" libs="stdc++"/>
          <Libset dir="" libs="supc++"/>
          <Libset dir="" libs="m"/>
          <Libset dir="" libs="gcc"/>
          <Libset dir="" libs="c"/>
          <Libset dir="" libs="nosys"/>

And of course, remove 
-lmbed; -lstdc++; -lsupc++; -lm; -lc; -lgcc; -lnosys; -lmbed; -lstdc++; -lsupc++; -lm; -lc; -lgcc; -lnosys;

from UserEditLinker in the xml file or just from Misc control in the IDE. The path to look for mbed library is already there thanks to using ld file which adds it to the linker searching path.

I tested this setup with cc3000 udp server demo. 

I added KL05Z exporter for CoIDE, can test it using project.py. There is also LPC1768 present, but currently has problems in CoIDE with CMSIS-DAP (due to the bootloader), so it's not enabled yet. 

January 11, 2014

CoIDE with KL25Z and mbed (C++) (tutorial)

I decided to start contributed to open source one year ago, as my start project I selected CoX library. I was pleased with CooCox CoIDE back in those days, it's light, easy to set-up, fast and was reliable. However, I abandoned CoX library since than as well as their IDE named CoIDE. This tutorial brings back CoIDE to my life as GCC is supported to all available Freescale targets.

I am running this tutorial on KL25Z, but as I checked, also NXP chips are supported there so this should be applied to more mbed targets than just KL25Z.

I ported CMSIS-DAP to many new freescale chips, now also bootloader is available. I was looking for open source IDE with working debugger. Finally, found something which is fast, reliable, and works with just few steps.

The very first thing is to install CoIDE.  Visit link CooCox IDE [www.coocox.org] . The installation is straightforward. Once installed, open your CoIDE and select toolchain path

I added there the following path :
C:\Program Files\GNU Tools ARM Embedded\4.7 2013q3\bin

If you want to test mbed with KL25Z in CoIDE, download the project here Hello world project KL25Z CoIDE [mbed.org/media/uploads/Kojto]. I'll explain below how to create your own project, so you can change anything you like like adding your own sources, libraries.

In the same tab as Select Toolchain Path, there's New Project (the top selection). Create a new project, select a name and click next. I use KL25Z_mbed as name of the project (which will be used in some steps, so might follow the same).
The next step is to select a chip or a board, just use Chip
The chip which is assembled on the freedom KL25Z board, is MKL25Z128VLK4. Then click Finish. The project is created and should be visible in the right bottom corner.

This creates an empty project with one code file (main.c). Please remove that file. Export a basic hello world example from the mbed site (GCC export option), as reference this one Hello world example [mbed.org/users/simon/code]. Add it to your online compiler and export it to GCC.

Unzip the exported Hello world anywhere. The example has only main.cpp file and the mbed folder which contains mbed library with header files + some object files. We need to copy those files to our new created project's folder. There is already .coproj file which gets created later, so don't get surprised by the below picture.

 After copying them, we go back to CoIDE where we need to set-up our new project. Click on the project with the right-button on your mouse, and select Configuration.
This is the crucial step, to set up correctly gcc project. There are few tabs : Device, Compile, Link and more.

We can skip device, as we already set device (chip). Go to the Compile tab:

Add include paths (mbed folder, target_kl25z folder inside and the toolchain_gcc_arm which is inside target_kl25z folder). Add to Misc. Controls:

-fno-common; -fmessage-length=0; -Wall; -fno-exceptions; -ffunction-sections; -fdata-sections; -DTARGET_KL25Z; -DTARGET_M0P; -DTARGET_Freescale; -DTOOLCHAIN_GCC_ARM; -DTOOLCHAIN_GCC; -D__CORTEX_M0PLUS; -DARM_MATH_CM0PLUS;  -std=gnu++98

We could add those defines up there to Defined Symbols, does not matter though. This should be for compile tab, move to the Link tab.

The important detail here is to uncheck Use Memory Layout from Memory Window and add linker script path (scatter file).

Add this to Misc. Controls:
--specs=nano.specs; ${project.path}/mbed/target_kl25z/toolchain_gcc_arm/cmsis_nvic.o; ${project.path}/mbed/target_kl25z/toolchain_gcc_arm/retarget.o; ${project.path}/mbed/target_kl25z/toolchain_gcc_arm/startup_MKL25Z4.o; ${project.path}/mbed/target_kl25z/toolchain_gcc_arm/system_MKL25Z4.o;

Add to Linked Libraries (just type the names there):
mbed, stdc++ , supc++ , m , gcc , c , nosys

The last thing to check is Debug tab, where select CMSIS-DAP, SWD and 1MHZ (this should be set as default for that chip).

Now press F7 (BUILD) which builds the project. It should display BUILD SUCCESSFUL if everything is correct along with size of the each areas and the command invoked.

Connect your board which mbed interface (CMSIS-DAP) and click on Debug icon (or press CTRL+F5). Debugging starts, it puts the breakpoint inside the main function, as it's shown in the picture below.

Happy debugging ! I am surprised with a speed, compared to pyOCD I tried with eclipse, this is really quick.

I will find out when other mbed chips are going to be supported.

Update1: I am currently working on an exporter to CoIDE for KL25Z, and probably later also other targets will follow.

January 6, 2014

CMSIS-DAP bootloader for K20 interface (news)

The freedom platform and some tower boards contain openSDA circuit. OpenSDA is managed by Freescale Kinetis K20 MCU (Cortex -M4).

It is claimed to be open-standard serial and debug adapter. It's not by "all" means, because the P&E bootloader can't be reprogrammed, as the chip is locked. Thus CMSIS-DAP interface was used on top of P&E bootloader.

CMSIS-DAP is the interface firmware which connects the Debug Port to USB. It consists of a debug unit and a device, both are usually assembled on a single board.

I was porting bootloader for K20 the last 3 days. As result, I sent yesterday a pull request to CMSIS-DAP repository (consider it's the first initial version as it's not yet on master branch), which means that the circuit openSDA (K20) will have full CMSIS-DAP support.
The link to my pull request Pull request #14 for CMSIS-DAP [github.com/mbedmicro/CMSIS-DAP]

You can freely design your boards which could use CMSIS-DAP (bootloader + interface). I will describe CMSIS-DAP more in the following days.