Starting from scratch again... On SW4STM32 now Topic is solved

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

Moderators: RoccoMarco, barthess

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Starting from scratch again... On SW4STM32 now

Postby Chudik » Thu Sep 15, 2016 11:48 pm

Something like an year ago (or more) I was trying to use ChibiOS with Em::Blocks. Then was interrupted for another projects (HW, FW) including a couple of regular one task FW that I developed using SW4STM32 (also Eclipse based, now I'm not so afraid of that :)) and CubeMX that makes initial configuration for my designs. CubeMX also provide .ld file

So, now I'm getting back to that project that I was working with using ChibiOS.
Definitely it should be based on the latest version (16.1.5 for now) and I hope to keep using SW4STM32 without additional software installation even though ChibiStudio is portable application.

My HW is not a "standard" Nucleo/Discovery board. That is my own design.
So, I would like to ask to help me at this starting point:
  1. How to define my own board that would be compatible with ChibiOS?
  2. Can I use *.ld file by CubeMX or I should use something else?
  3. Which project should I import as a starting point? Closest from the demos that come in ChibiOS package or something else? What should I change if so?
  4. If I import one of those demos, will it be imported with all necessary files for the ChibiOS?

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

Re: Starting from scratch again... On SW4STM32 now  Topic is solved

Postby Giovanni » Fri Sep 16, 2016 6:05 pm

Hi,

Regarding your questions:

1) ChibiStudio includes a board files generator, do a search in the forum and several topics should pop up.

2) You must use the .ld files provided with ChibiOS. You could use other scripts but no guarantee.

3) The one closest to your case, preferably one using the same STM32 model. Then you change the board files and tweak mcuconf.h if the xtal frequency is different.

4) ChibiOS includes code and demos, the ChibiOS code is not inside the demo, it is imported by the makefile.

I recommend you just use ChibiStudio until you feel confident enough to work out differences in other environments. SW4STM32 should not be difficult anyway.

Giovanni

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: Starting from scratch again... On SW4STM32 now

Postby Chudik » Fri Sep 16, 2016 10:29 pm

Question about the ChibiStudio. Does it absolutely must be in C:\ChibiStudio or can use another path?

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: Starting from scratch again... On SW4STM32 now

Postby Chudik » Sat Sep 17, 2016 4:35 am

Found one project on github that combines SW4STM32 with ChibiOS
https://github.com/swiedjaja/Cube-F411RE-ChibiOS

Seems like not too complex task to do it. At least, I was able to compile it. :) It's a good start.
The author did not update the project for a year, though.

In CubeMX the author did not assign any interrupt but sysclk. He included ChibiOS sys clock service as a callback for the interrupt.

Giovanni
As far as I understand, ChibiOS takes care about all interrupts, correct?

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

Re: Starting from scratch again... On SW4STM32 now

Postby Giovanni » Sat Sep 17, 2016 9:40 am

Correct, the startup files include a vectors table.

Giovanni

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: Starting from scratch again... On SW4STM32 now

Postby Chudik » Tue Sep 20, 2016 10:17 pm

I give up on transferring ChibiOS to SW4STM32. Need to work on project, not on environment.
Some things I figured out how to work with, some others - not.
May be later... Or, if somebody decide to continue, I will let him/her know where I stopped and which things figured out.

For now it is easy and faster for me to install VirtualBox with WinXP and use ChibiStudio in C:\ChibiStidio directory in the VirtualBox

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: Starting from scratch again... On SW4STM32 now

Postby Chudik » Wed Sep 21, 2016 4:29 am

There are so many problems with the Virtual Box.... Decided to get back.
Got some progress, but so far could not get GDB working with a project imported directly from the ChibiStudio demos.

User avatar
Chudik
Posts: 152
Joined: Fri Jan 16, 2015 7:51 am
Location: California
Has thanked: 7 times
Been thanked: 1 time

Re: Starting from scratch again... On SW4STM32 now

Postby Chudik » Fri Sep 23, 2016 1:09 am

So far I got compiled in SW4STM32 (by Ac6) demo project for STM32L1_NUCLEO working on the Nucleo board.
For this I did the following:
  1. Copied whole directory of ChibiOS_16.1.5 into my working directory.
  2. Set path to Ac6 GCC in C/C++ Build environment
  3. Copied all tools utilities to Ac6 tools. They provide only make and rm
  4. Added correct paths for os, board, test directories links in the project. (They are not in C:\Chibios, of course)
  5. Added <machine/types.h> to include list. Otherwise types like uint8_t and others were not defined.
  6. probably made some other adjustments. (Need to do everything one more time with writing each step to recall all things)
  7. Finally got the project compiled. It got as same size as compiled in ChibiStudio. Since the board by default has similar LED blinking as RT version, made small change - 50ms of LED on and 950 ms of LED off
  8. Downloaded the hex file into the board by using STM32 ST-LINK Utility and ran it. Ran Tera term at 38400 and pressed user button on the board. Test passed successfully. Note: programming the board with binary file does not look like working option

During compilation got the following messages:

Code: Select all

Description   Resource   Path   Location   Type
Program "gcc" not found in PATH   RT-STM32L152RE-NUCLEO      [Discovery Options] page in project properties   C/C++ Problem
Symbol 'NULL' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 58   Semantic Error
Symbol 'NULL' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 63   Semantic Error
Symbol 'size_t' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 27   Semantic Error
Symbol 'size_t' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 27   Semantic Error
Symbol 'size_t' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 27   Semantic Error
Symbol 'true' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 32   Semantic Error
Symbol 'true' could not be resolved   main.c   /RT-STM32L152RE-NUCLEO   line 69   Semantic Error


However, how I said, the program is working.
Need to find where NULL, size_t, true defined and figure out which part could not find gcc

What I could not do so far:
  1. Run GDB.
  2. Import exported file separately from the whole bunch of demos and get it compiled. However, it was my first approach. May be after I compiled project from the whole directory I will be able to do it.
  3. Start native SW4STM32 project and add RT project to it. Seems like I was able to add all needed files, but IDE could not compile the project at all. I believe, this option would allow to have GDB right away, but...

Giovanni,
Could you help with a couple of things:
1. Show me where NULL, size_t, and true defined? I think, this should be easy.
2. Help to figure out how to tune GDB? While combining SW4STM32 project structure with ChibiOS would be great, if debugging works, I can live with simpler project interaction.
3. Figure out who could not find gcc. It probably less important, while would be better to eliminate this error message.

I will not deny some help from anybody else :-)

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: Starting from scratch again... On SW4STM32 now

Postby steved » Fri Sep 23, 2016 8:41 am

Chudik wrote:Question about the ChibiStudio. Does it absolutely must be in C:\ChibiStudio or can use another path?

Possible to run from another path (I've got an installation in D:\ChibiStudio).
It's necessary to change some of the linked variable definitions (in particular CHIBIOS - the root of the Chibi directories, and possibly others) and re-import demo projects (if you want them available).
Also necessary to change paths in the startup batch files.
I found it useful being able to compare properties/setup with an installation on C:\ to make sure I hadn't missed anything.

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

Re: Starting from scratch again... On SW4STM32 now

Postby Giovanni » Fri Sep 23, 2016 10:36 am

I cannot help with the toolchain.

NULL, size_t etc are provided by standard C headers. Probably you are getting those errors for the same reason you don't find GCC.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 46 guests