Showing posts with label Work. Show all posts
Showing posts with label Work. Show all posts

Friday, 13 April 2012

Booting up

Edited: 20120413 to add images and fix some errors.

OK, so today was fun, I received my Olimexino-STM32 that I talked about yesterday and I was able to do a few things with it:
  1. Set it up so that I could use it with the Maple integrated development environment ('IDE') - a simple IDE that allows a 'fast-start' and that comes with quite a few 'example' programmes to show the capability of the device, and also provide a basis for one's own projects.
  2. Programmed it to make some LEDs flash on and off in different sequences
  3. Set it up so that I could use it with the Eclipse IDE - a much more powerful IDE that provides more flexibility (at the cost of more risk of doing something that can't be easily undone)
  4. Programmed it again using Eclipse to make the LEDs flash on and off, using a JTAG interface
  5. Worked out how to return the board to being able to work with the Maple IDE (since using the Eclipse IDE to download code removed the bootloader that the Maple tool requires)

This last bit was  quite tricky and not all that obvious!  So a description follows for anyone out there trying to work out how to make this work... especially as most of the instructions I could find are Linux-based, so I made sure I could do this using the Eclipse IDE on my windows machines too!

Note that all of this assumes that you've already set up Eclipse, the various drivers and other software required and have a JTAG interface to hand!

Firstly you need to make sure that you have copied the OpenOCD files and the Olimex examples into a folder structure that mimics that found under your 'Program Files' folder, and make this your workspace (short paths with no spaces are better, mmm-kay?):


Next, go download the Maple bootloader source and unzip it.  Move the folder named something like 'leaflabs-maple-bootloader-d1234348' (yours will have a different name) into your workspace folder and rename it to something a little shorter, I called mine, 'stdBoot' (you can see this in the image above).

In Eclipse right-click in the projects pane and select 'Import', click on 'C/C++' and then select 'Existing Code as Makefile Project' and click 'Next':


For the 'existing code location' browse to the 'stdBoot' (or whatever you called it) folder, and select just this folder:


Click on 'Finish'.  The folder and contents should then appear in the projects pane.  'Borrow' (copy and paste) the stm32.cfg and openocd.cfg project.cfg files from one of the other STM32 projects for your 'stdBoot' folder:


OK, almost there!  If you've not done so already then hook up your board to your computer via the JTAG.  You also need to power the board - to do this I use a USB lead that is broken and supplies only power (otherwise the PC will try to load the USB drivers that the JTAG needs and reserve them!).

Try clicking the 'Run external tool' entry in Eclipse that matches your JTAG interface (for me this is the ARM-USB-TINY-H), if you get an error like this:



Then just click in the pane holding 'main.c' and try again, what you should see is this:


Which appears in the console panel end finishes something like:  "stm32.cpu: hardware has 6 breakpoints, 4 watchpoints".  This is good and means that everything is running,  


Ensuring that you're in the C/C++ perspective of Eclipse, expand your 'stdBoot' project and open the 'Makefile' - on my PC the make action failed to make some folders, so look through for 'mkdir' commands and create the folders that make will require.  Unless you know exactly what you are doing, DO NOT EDIT THE MAKEFILE!  In my Makefile, the mkdir commands are:



Now right click on the 'stdBoot' project and select 'Build as...' 'Make Targets'/'Build', in the dialog that appears, click on 'Add', then in the top text entry box type 'all' (without the ''), then click 'OK':


Now select the 'all' entry in the 'Make Targets' window and click on 'Build'.

If your setup is OK then you'll see a successful build occur.  Warnings are undesirable, but survivable - 'Errors' though are a big problem!  Check the console carefully - if you've had a successful build then you will receive a report of the file sizes created.  If you see errors, then Google is your friend!  A good outcome looks like this (just cancel any errors from 'mkdir.exe' as we've already circumvented these):


Now, right-click your project and under 'Debug as...' select the 'Debug configuration' option.  In the new window select 'Zylin Embedded Debug (Native)' and click the 'New launch configuration icon' button:


Fill out the Debug configuration name and there are now some tabs to fill out:
  • On the first tab, 'Main', in the C/C++ application box type: build/stdBoot.bin

  • On the second tab, 'Debugger', in the 'GDB debugger' box type: arm-none-eabi-gdb (if you've not added the yagarto/bin folder to your path then browse to that file)

  • On the third tab, in the 'Run' commands type:
target remote localhost:3333
monitor gdb_breakpoint_override hard
monitor soft_reset_halt
symbol-file build/stdBoot.bin
break main


target remote localhost:3333
monitor reset halt
monitor wait_halt
monitor sleep 100
monitor poll
monitor flash probe 0
monitor flash write_image erase main.bin 0x08000000


  • On the 4th and 5th tabs do nothing (you can 'add to favourites' on the 6th tab if you want to)
Next click 'Apply' and then 'Debug' - you should see the console window show a load of information (again check it for errors, of which there should be none) and you have just flashed your board back to the Maple bootloader.  Save everything.  You can now use this project to restore your Olimexino back to the standard bootloader if you ever have any problems, or if after using Eclipse you decide that you want to go back to the Maple IDE.

I know this is quite long, so if I can I'll add some explanatory images I hope the images are useful!

Wednesday, 30 November 2011

DELIVERing the future

Crumbs - it's a while since I've been here, in my defence it's been a very busy time.  Work has been off the scale, and studying as well has loaded me up to the point where pretty much all I do is eat, work, sleep and study since July!  Only another 9 months of this to go though...


Anyway, what's been going on?  Well at work we have secured a part in an EU seventh framework programme - with the acronym "DELIVER" (do you see what I did in the title now?).  The EU webpage for this is here: http://www.green-cars-initiative.eu/public/projects/deliver


In case the link moves or changes this says:


Design of Electric Light Vans for Environment-Impact Reduction

The DELIVER project concept aims to explore urban light duty vehicle concepts intended for larger scale production by executing a broad scope conceptual design study which will start by establishing initial design specifications and continue right through to the detailed realistic performance assessment of one prototyped vehicle concept.
DELIVER is pre-competitive, focusing on the rules of the design of ELDVs to be launched by 2020, and providing a platform for integrated design brought together into one holistic design by a team of experienced design engineers and design researchers of various backgrounds.
The project will build upon the progress made and foreseen in subsystems and main components that are to be integrated into the ELDV through networking with complementary R&D projects, as well as with the support of a multi stakeholder Advisory Board consisting of high level representatives of Europe's cities, large urban delivery fleet owners and others.

If you want to find out more about the project participants and the EU Green Cars initiative then there is a project portfolio document (PDF) available from the EU website here: http://www.green-cars-initiative.eu/public/documents/GreenCarsInitiative-Broschure_09-2011_WEB.pdf/view


As a small UK company it's a measure of how well the UK electric vehicle industry is regarded for us to be involved in an international concept vehicle project with both VW and Fiat - and we have some other similar projects in the application process, so I hope to be able to talk about these more in the future.

Friday, 17 June 2011

Ohai2u!

Hello there!


So here we are... I have no idea where this is going to go, or how it will get there, but it should be interesting to find out.


I suppose the first thing I should tell you is a few things about me, for those too lazy to read my account; I live in Warwick in the UK and I am in the middle of a few things, I'll probably write about them now and then:

  1. A part-time MSc in Control Engineering.  This came about after an argument with a (now ex) girlfriend where we split up for a while, I decided that I would need something to do, and decided, for want of a better expression, to "improve myself" in a way that might make me more useful at work (q.v.).  At the time of writing I have about 9 months left to go (which will be taken up with my project, this will involve some Matlab and the report for which will have to be written in LaTeX).
  2. Teaching myself to play the guitar (this has been going on for about 6 years), one day I expect I'll get around to paying someone for a lesson.
  3. Relearning to play the cornet (I first learnt at school, a few years ago now).
  4. Running a photography business.
  5. Sitting on the board of a high technology company that is in the field of electric vehicle design and engineering.  Primarily I'm responsible for all electrical and electronic systems activities, but I also have some input into other areas, such as customer service and information systems.

Something I'm planning to add to the above is that I want to work through, "The Elements of Computing Systems: Building a Modern Computer from First Principles" by Noam Nisan and Shimon Schocken, which is freely available at: http://www1.idc.ac.il/tecs/ so feel free to join in if you'd like to.