I just ported a demo application to a new baord/cpu. Everything just works, but... I've had to change/add about 1800 lines-of code.
In reality I didn't need to change all that much. I'd like to reorganize chibios and the demos/testhal programs to be more compact.
So for example, almost all board.mk files are very very similar. So what I do in my projects is to define BOARD=<directory with the boardfiles> . Now the board.mk file becomes the same for (almost?) all board.mk files in chibios. We can then include THAT makefile part in the general: include $(RULESPATH)/rules.mk
Next all the board.c files are VERY similar. Stuff like initializing the GPIOs... this can be moved somewhere central. Using a "weak" symbol would allow users to override this. But the fact that all board files happen to do it means that it is something essential that chibios can offer.
Next... the config files... I think there should be a "default" config file. It defines most things to be OFF, but creates a CPU-working situation. So internal clock, that sort of stuff. Then: in each project, you define JUST the stuff that you use. Of course, the demos should come with // #define USE_SPI TRUE to make it easy for users to know what can be enabled. But this way when chibios adds a feature with a config flag in one of the config headers, existing projects that don't use the feature should continue to work. Now when I've configured my project and I remove all the comments, I should be left with projects's config, for a simple project that does uart <-> SPI something like #define HAL_USE_UART #define HAL_USE_SPI and nothing more.
I'm willing to contribute hours to this project, but I can't do it alone. I'd like to have someone else who thinks this is useful to help. And if Giovanni won't accept the patches it's useless. So I also need an OK from Giovanni before I can start putting in the effort.
chibios: reducing code.
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: chibios: reducing code.
Hi,
Configuration files and board files are generated. If you create a new .chcfg all defaults are in there. If you empty a configuration file except for the identifiers all defaults will be restored by the updater tool.
Also consider that makefiles are important but not central, we need to support any build system.
Giovanni
Configuration files and board files are generated. If you create a new .chcfg all defaults are in there. If you empty a configuration file except for the identifiers all defaults will be restored by the updater tool.
Also consider that makefiles are important but not central, we need to support any build system.
Giovanni
Re: chibios: reducing code.
OK. I downloaded the stupid thing. Then I get a welcome screen with a "readme" link. CLick there. Download more and... screen is VERY complicated but no "readme" info.
new chibios project? new menu entry gives me "java project" and "enum" as options. Where is chibios? Tried navigating the menus, but NOTHING seems plausible.
Found a turorial. When switch the workspace I get an internal error. and the program quits.
new chibios project? new menu entry gives me "java project" and "enum" as options. Where is chibios? Tried navigating the menus, but NOTHING seems plausible.
Found a turorial. When switch the workspace I get an internal error. and the program quits.
So I'm not using Eclipse. After today trying it and getting nowhere I'm fed up with that again. So how do I generate an empty project that "just works" and I need to enter say 5 lines of code to blink a led on a new board?Also consider that makefiles are important but not central, we need to support any build system.
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: chibios: reducing code.
Launch the stupid thing and:
1) Select a project.
1) Create a board/cfg directory in your project, right click New -> Folder.
2) Right click on board/cfg -> New
3) Other... -> ChibiOS -> ChibiOS Configuration Wizard
4) Select the family and you get a .chcfg file.
5) Configure it.
6) Generate using the button that appears in the toolbar after clicking on board.chcfg.
If you don't like eclipse then in /tools/ftl/xml there are the base XML files:
1) Create a board/cfg directory in your project.
2) Take the XML and rename it board.cfg, place it in board/cfg.
3) Take board.fmpp from any board and place it in the directory. Edit it to adjust path names.
4) Run /os/hal/boards/genboard.sh does the generation, run it from your project root. You need FMPP installed: http://fmpp.sourceforge.net/ which also requires Java.
ChibiStudio is not meant to be easy nor complete, it is a facility we provide as-is for convenience of those who understand some Eclipse. If it is not good enough for you, which is probably true, then use whatever you like most.
I am not interested in the proposal.
Giovanni
1) Select a project.
1) Create a board/cfg directory in your project, right click New -> Folder.
2) Right click on board/cfg -> New
3) Other... -> ChibiOS -> ChibiOS Configuration Wizard
4) Select the family and you get a .chcfg file.
5) Configure it.
6) Generate using the button that appears in the toolbar after clicking on board.chcfg.
If you don't like eclipse then in /tools/ftl/xml there are the base XML files:
1) Create a board/cfg directory in your project.
2) Take the XML and rename it board.cfg, place it in board/cfg.
3) Take board.fmpp from any board and place it in the directory. Edit it to adjust path names.
4) Run /os/hal/boards/genboard.sh does the generation, run it from your project root. You need FMPP installed: http://fmpp.sourceforge.net/ which also requires Java.
ChibiStudio is not meant to be easy nor complete, it is a facility we provide as-is for convenience of those who understand some Eclipse. If it is not good enough for you, which is probably true, then use whatever you like most.
I am not interested in the proposal.
Giovanni
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 17 guests