[info] Setting up rusEFI on ChibiStudio

It's all about the code!
Post Reply
jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Setting up rusEFI on ChibiStudio

Post by jedediah_frey »

Click here for info on pre-compiled binaries

ChibiStudio is a IDE based on Eclipse for Windows. It is created by the ChibiOS/RT developer to include everything you need to get started including GNU tools, GCC and OpenOCD.

1) Download ChibiStudio http://sourceforge.net/projects/chibios/files/ChibiStudio/

Current version at the time of this post is Preview5.

Extract the file to your C:\ drive.

ImageImage

**Note** ChibiStudio is compressed with 7z, you can decompress it with 7-zip or izArc.

You can put the ChibiStudio shortcut (C:\ChibiStudio\Chibi Studio.lnk) you want: Desktop, Start Menu, etc.

2) You now need to set the paths. Everything needed is in the C:\ChibiStudio\tools directory. In particular:
  • C:\ChibiStudio\tools\GNU Tools ARM Embedded\4.7 2013q2\bin
  • C:\ChibiStudio\tools\yagarto-tools\bin
  • C:\ChibiStudio\tools\openocd\bin
Image

You can set these manually under Computer > Properties > Advanced System Settings > Environment Variables...

Or using a tool such as Windows Path Editor. Note, if you have no UserPath set then drag and drop will not work. Copy the code below and put it into a text file named setPath.bat and run it. **Note** Only do this if you do not have any other User Variable defined Path, it will overwrite it.

Code: Select all

setx PATH "C:\ChibiStudio\tools\GNU Tools ARM Embedded\4.7 2013q2\bin";C:\ChibiStudio\tools\yagarto-tools\bin;C:\ChibiStudio\tools\openocd\bin
3) Download rusEFI. For this post I will be using r100 available on SourceForge. You can extract this anywhere you would like however I have put it in C:\ChibiStudio\workspace\ so the full path to the firmware is: C:\ChibiStudio\workspace\rusefi.r100\firmware

Image

4) Test out that you have the path setup correctly. Open up the command prompt and change to the rusEFI firmware directory.

You should be able run 'make' and compile the firmware with no errors.

ImageImage

5) Open ChibiStudio

Image

File > Import... > General > Existing Project into Workspace. Next.

Select root directory. Select the firmware directory.

Under "Workspace" add it to the Common working set.

Image

6) You should now have a 'chibios_template' under Common. **ToDo: Edit the files distributed with rusEFI so it has its own project name**. You can rename this to rusEFI by right clicking on the project or using F2.

Image

7) Now you have to copy the compile settings from another project.

**Note** This is the easiest way to do this. Hopefully in the future I learn enough about eclipse to do this from scratch.

Open ARMCM4-STM32F407-DISCOVERY under ChibiOS/RT STM32 Demos by right clicking on it and selecting "Open Project".

Right click on the rusEFI project and select Properties. Then select C/C++ Build then "Manage Configurations".

Image

Delete 'Default' and confirm, then press "New...".

Create a name ('Default') and 'Import from projects.'

Select ARMCM4-STM32F407-Discovery>Default.

Image

Now delete the 'Release'.

Image

**Note**: You can do this without deleting Default first, however you can not name your new configuration 'Default'.

8) Now you can build your project. Right click on the rusEFI project folder and select "Clean Project". This is necessary to clean out the old build files from the test build we did above.

Right click again and select "Build Project". The build should complete without any problems.

10) Setup Debug

Select "Run > Debug Configuration" from the Menu or click ot the dropdown next to the small bug and select "Debug Configuration".

Image

Right click on the "ARMCM4-STM32F406-DISCOVERY (OpenOCD, Flash, Run)" and select "Duplicate". Rename the project to "rusEFI (OpenOCD, Flash, and Run.

Under C/C++ Application, change it to ./build/rusefi.elf

Next to Project select browse and select rusEFI.

Select "Apply" and then "Close". (If you click on Debug it will attempt to debug the project, not yet)

11) To start the debug process you must first launch OpenOCD.

You can do this from the External Tools configuration drop down. (The Play symbol with the toolbox).

Open OCD on ST-Link v2 (prompts for .cfg target configuration), and select C:\ChibiStudio\tools\openocd\scripts\board\stm32f4discovery.cfg

This will start OpenOCD and prepare it for debugging.

12) Now select 'rusEFI' under the debug menu. It should automatically download the program and break as soon as it enters main().

Image

13) Create a 'Run' configuration.

** Note: You must have ST-Link installed for this**.

Edit run configuration from Run Menu > Run Configurations....

Right click on C/C++ Application and create a new configuration.

Image

Name it "Run rusEFI".

Browse to and select ST-LINK_CLI.exe, for Windows 7 x64 it should be:
C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ST-LINK_CLI.exe

Image

Under the Arguments tab enter:

-c SWD HOTPLUG -P build/rusefi.hex -Rst

Image

This will allow you to flash and run directly from the Gui.

And that's all there is to it. Now you can either debug or run your program just by pressing the debug icon or run icons (or keyboard shortcuts) and have the application automatically downloaded.

ChibiStudio/Eclipse also hase some nice features like a built in terminal:

Image
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up rusEFI on ChibiStudio

Post by AndreyB »

This. Is. An. Amazing. Write-up!

I've followed it precisely and I've got debugger functional right away. And I REALLY needed the debugger.

And by the way Windows Path Editor is a great utility, on a couple of occasions I've tried to find something like that but always ended up using the default windows dialog which is horrible.

Jed, would you have the patience to add a section on how to install SVN plugin into Eclipse? From my experience, it was also confusing since I recall I had to take pieces from three different sources.

With SVN integration I think this should become the official way to work with rusEfi source codes. Actually, I wonder if after we set it with SVN we should pack it and make the pre-set bundle available for download, with everything already there?

Update: I have a bit of a problem: everything is perfect until I need to close Chibi Stidio. When I close it, the project gets lost :( I guess it's about Windows 7 and some permission issue with "c:\ChibiStudio" folder. My windows user is Administrator. Since we are launching a .bat file here I am not sure how to run it with full privileges.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Setting up rusEFI on ChibiStudio

Post by kb1gtt »

Great write up. I'll try to follow it this weekend.

How crazy and or wrong would it be for russian to SVN his copy of Chibios studio such that a new developer can simply check out the top level SVN, then run a bat script to fix the path, then compile? This would help ensure that people are using the same lower level compiler bits and might help make it easier for developers to jump right in. I saw some one had changed a lower level portion of it for one reason or another. Doing it this way would allow such a change to be propigated across several developers, making for a bit more consistent developer base.

If the SVN structure is setup with rusefi source under top level, and the compiler sitting closer to the top level, then people could do a straight check out of the code with out the IDE if so chosen. I know it's probably wrong on many levels, but figured I'd toss out an inquiry about why not do it that way.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up rusEFI on ChibiStudio

Post by AndreyB »

kb1gtt wrote:How crazy and or wrong would it be for russian to SVN his copy of Chibios studio...
Hm. Maybe even SVN it. For now, it would be great if someone at least makes a custom archive with embedded SVN plugin. Or, even better, an archive with checked-in firmware project & Eclipse project - so that one can
1) download the package
2) uncompres it
3) run it
4) update sources to the up-to-date state.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
aut0m4tic1
Posts: 9
Joined: Fri Jan 10, 2014 5:18 am

Re: Setting up rusEFI on ChibiStudio

Post by aut0m4tic1 »

Looks like the images are missing? :(
User avatar
hasse.69
donator
donator
Posts: 77
Joined: Wed Dec 04, 2013 3:34 pm
Location: Sweden Linkoping/Vadstena

Re: Communication module

Post by hasse.69 »

:D
Last edited by hasse.69 on Sat Jan 25, 2014 5:05 pm, edited 3 times in total.
"Electronically challenged of the world, unite!"
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Setting up rusEFI on ChibiStudio

Post by AndreyB »

I do not have the pictures, I have emailed jedediah_frey to no avail :( And I have not received any PMs :(

I suggest you install the command-line compiler as described at http://rusefi.com/forum/viewtopic.php?t=9
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
jengeltx
Posts: 5
Joined: Thu Jun 12, 2014 2:58 am

Re: Setting up rusEFI on ChibiStudio

Post by jengeltx »

I'm not a programmer and the original toolchain was too complicated for me.

As a followup to Mr. Frey's setup, I've tried a couple of times and seem to have succeeded.

Steps:

1. Install 7-Zip.
2. Download ChibiStudio. Mine was version 'Juno'.
3. Install ChibiStudion by following the steps in readme.txt.
a. It installs by expanding the .7z file to C:\.
4. Download RusEFI. Mine was version 'rusefi.r4438'.
5. Expand it. I used the 'Download' folder.
6. Open ChibiStudio.
7. Files -> Import
8. Select 'Existing Projects in Workspace', then 'Next'.
9. Select your RusEFI project folder as the 'root directory'. Mine was entitled 'chibios_template'.
10. Make sure 'Copy projects into workspace' is selected.
11. Click 'Finish'.
12. In the Project Explorerer pane in ChibiStudio, right-click on 'chibios_template' and rename it. I used 'RusEFI'.
13. Projects -> Build Clean
14. Projects -> Build All

RusEFI compiled nicely with only 1 warning. GCC didn't like a 'missing' return in main.c.

I haven't had the chance to upload the results to my Discovery board, but was pretty excited that the install and compile went so well.

Disclaimer: I'm an absolute newbie to Eclipse and not much more experience with ARM, so may have made some really interesting mistakes. My understanding is that importing the RusEFI project is a standard importation.

Regards,

Jeff Engel
Happiness is - positive manifold pressure.
Post Reply