ChibiOS with Eclipse and stm32f405 in ubuntu linux Topic is solved

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

nami1216
Posts: 9
Joined: Wed Aug 21, 2019 5:05 pm
Has thanked: 2 times

ChibiOS with Eclipse and stm32f405 in ubuntu linux

Postby nami1216 » Wed Aug 21, 2019 5:14 pm

Hi friends.
May you help me?
I am trying to program stm32f405. I want to use ChibiOS.
Because I am new for ChibiOS. May you tell me. How to setup ChibiOS into Eclipse (oxyden) in Ubuntu Linux?
Actually, I searched many time on internet how to setup ChibiOS, but nothing I found. So, I hope I can get your help, your instructions.
Thank you so much
Best wish to you.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: ChibiOS with Eclipse and stm32f405 in ubuntu linux

Postby Giovanni » Wed Aug 21, 2019 6:35 pm

Hi,

We have a Linux VM with everything installed, you could start from there and replicate it in your Ubuntu installation:

viewtopic.php?f=3&t=5176

Giovanni

nami1216
Posts: 9
Joined: Wed Aug 21, 2019 5:05 pm
Has thanked: 2 times

Re: ChibiOS with Eclipse and stm32f405 in ubuntu linux

Postby nami1216 » Thu Aug 22, 2019 5:42 am

Hi Giovanni.
Thank you for your reply.
As you said, I have to download Linux VM.
Are there others ways? Now I want to use Eclipse and plug ChibiOS in it.
Thank you so much.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: ChibiOS with Eclipse and stm32f405 in ubuntu linux

Postby Giovanni » Thu Aug 22, 2019 6:29 am

The VM already contains ChibiStudio, use the launchers in the toolbar.

Giovanni

mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: ChibiOS with Eclipse and stm32f405 in ubuntu linux  Topic is solved

Postby mikeprotts » Thu Aug 22, 2019 8:30 am

If you're familiar with Linux, openocd and arm-none-eabi gcc cross compiler and gdb debugger are quite easy to setup and use. You will need recent enough versions to support the chip & board you are using.

I use the standard make, and a simple Makefile, to build with arm-none-eabi-gcc.

STLink works well over USB, but for other boards I use a Raspberry Pi with GPIO pins directly wired for programming.

Get it working with a demo, then clone the demo and make small changes and test.

Mike

nami1216
Posts: 9
Joined: Wed Aug 21, 2019 5:05 pm
Has thanked: 2 times

Re: ChibiOS with Eclipse and stm32f405 in ubuntu linux

Postby nami1216 » Fri Aug 23, 2019 12:59 am

Hi mikeprotts.
Actually, I used Eclipse, openocd, arm-none-eabi gcc, and STLink successfully before. That time I only programmed for blinkly led. Now I want to use ChibiOS to program. My problem is I do not know how to plugin ChibiOS into Eclipse. I am new for ChibiOS, So many steps, how to configure it into Eclipse I do know. I searched on internet for tutorial. But nothing is clear until. May you guide how to use the standard make, simple Makefile to build with arm-none-eabi-gcc.
thank you so much, mikeprotts

mikeprotts wrote:If you're familiar with Linux, openocd and arm-none-eabi gcc cross compiler and gdb debugger are quite easy to setup and use. You will need recent enough versions to support the chip & board you are using.

I use the standard make, and a simple Makefile, to build with arm-none-eabi-gcc.

STLink works well over USB, but for other boards I use a Raspberry Pi with GPIO pins directly wired for programming.

Get it working with a demo, then clone the demo and make small changes and test.

Mike

mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: ChibiOS with Eclipse and stm32f405 in ubuntu linux

Postby mikeprotts » Fri Aug 23, 2019 10:22 am

I prefer to use make from the command line as I often need to work remotely. I've been using ChibiStudio from Windows for looking at the memory usage as it's a lot easier that way. I've not got it working from Linux yet.

I started with one of the boards with a demo, so I knew the only untested variable was my system. STM32CubeMX makes it easy to find a good match for the requirements, and I've found it quite easy to swap between different boards and processors, so doesn't matter if it's not exactly the same processor to start with.

So if you choose one of the STM32F4 boards with a demo project, change to that demos directory (e.g. ChibiOS_18.2.1/demos/STM32/RT-STM32F407-DISCOVERY) and issue make. It should be fairly easy to sort out whatever's currently missing in the build tools. You may need to install a local updated version of the compiler, but using the standard package first means at least dependencies will be sorted out easily. Start with the Demo as provided and I would expect everything to work.

Then the openocd command is a bit obscure, something like:
openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "program build/ch.elf verify reset" -c "shutdown"

The next stage is to clone the original Demo to a different clean directory, and make sure a clean build works from there. That needs the Makefile paths updated (a likely change is CHIBIOS path, e.g. CHIBIOS = ../ChibiOS_18.2.1).

After that, I add my code, always testing the minimum change each time. Only after getting the first part of my code working, I then remove the original demo code that I no longer need (again just one bit at a time).

For debug, I use two terminal sessions, one:
openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "init" -c "reset"

The other using gdb:
arm-none-eabi-gdb -x openocd.gdb

With openocd.gdb:
target remote localhost:3333
monitor reset halt
monitor wait_halt
monitor sleep 100
monitor poll
monitor flash probe 0
monitor flash write_image erase ./build/ch.elf 0x08000000
monitor sleep 200
monitor soft_reset_halt
monitor wait_halt
monitor poll
symbol-file ./build/ch.elf
thbreak main
continue

Hope this helps.
Mike


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 10 guests