Author Topic: Adding a new project type for a new embedded device/board  (Read 11252 times)

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 55
Adding a new project type for a new embedded device/board
« on: September 25, 2018, 11:02:22 am »
Hello all,

I am investigating using Code::Blocks for embedded development for a microcontroller. We are looking to provide a full IDE that makes the development process as simple as possible, with Project Wizards etc to provide up front code generation, and Code::Block to provide the editing and debugging facility (probably using OpenOCD, with compiler support via a standard gcc). Code::Block is top of the list because it's multiplatform, and works well on low memory ARM systems, unlike Eclipse which has no recent ARM host support, and is quite the memory hog.

I've spent a couple of days trawling around various IDE's; Code::Blocks seemed the simplest to write plugins for (TBH, I know C++, not Java!) and I have been impressed by its performance on low end machines.

So really, my question is, is there a set of docs that helps with the process of developing this entire toolchain and packaging it up in project form so our users can simply go "New->Project->'Microcontroller'" and be guided through the entire process of getting an initial build going and downloaded to the MCU?

Thanks

Jimbo.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Adding a new project type for a new embedded device/board
« Reply #1 on: September 25, 2018, 11:43:26 am »
Not much. But we could help with info about areas where you're not able to do what you want.
Also we're open to improve areas of C::B which aren't good enough.

To get going you need two things:
1. a way to setup the compiler and other build tools in the compiler settings.
2. a wizard script which creates projects

Compilers theses days are described using xml files and wizards are written in squirrel. For both it is best to use existing files as guides.
You can look at my arduino wizard scripts https://github.com/obfuscated/cb_arduino_template for an example.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 55
Re: Adding a new project type for a new embedded device/board
« Reply #2 on: September 25, 2018, 12:21:25 pm »
Thanks for the response.

I was wondering if my Google-Fu was failing me as I hadn't found much, so useful to have the clarification! I had taken a quick look through some of the other scripts to get an idea, didn't seem too horrendous! Will have a go through your one now.

Compiler is going to be gcc ARM cross compiler, probably Cortex M0, so not dissimilar to stuff already there.

It's a few months till we need to get really cracking on this, but if we choose Code::Blocks, I am sure I'll be back with more questions.

Jimbo

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 55
Re: Adding a new project type for a new embedded device/board
« Reply #3 on: September 25, 2018, 03:39:18 pm »
Actually do have some more immediate questions, if you have time.

Been playing with the Squirrel scripts for wizards, which seems fairly clear, and saw in your Arduino example that you have what looks like custom dialogs and panes, defined in a xrc file. How do you generate those files? With an editor, or are they defined by hand?

I am presuming that the wizard.xrc file contents are automagically included in the Squirrel namespace (if that is what its called), so its content acts just like any other library of squirrel code. Hence you can, for example, use "processorChoice" from the wizard.xrc without any boiler plate loading code?

Do you know if there is already a predefined page with a list box style selector for multiple selection (for example, if you want to custom define which peripheral source files you want to include). I'll be taking a look anyway, but not entirely sure where to look for available features. That sort of page would mean we probably would not need a custom page straight away.

Thanks

Jimbo.


edit: answered my own question for part three - no there isn't, but your example Arduino code  does much that I think we would need so is a great starting point. I was a bit confused until I copied the latest github code to my code::blocks installation - I was comparing the old UI with the latest source....doh.
« Last Edit: September 25, 2018, 04:52:20 pm by jimbo »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Adding a new project type for a new embedded device/board
« Reply #4 on: September 25, 2018, 05:16:51 pm »
Been playing with the Squirrel scripts for wizards, which seems fairly clear, and saw in your Arduino example that you have what looks like custom dialogs and panes, defined in a xrc file. How do you generate those files? With an editor, or are they defined by hand?
I don't remember. Probably we're using the wxSmith C::B plugin. There are other tools which can edit UI graphically. The file is regular wxWidgets xrc file, so if you search for it you should be able to find info.

I am presuming that the wizard.xrc file contents are automagically included in the Squirrel namespace (if that is what its called), so its content acts just like any other library of squirrel code. Hence you can, for example, use "processorChoice" from the wizard.xrc without any boiler plate loading code?
It is not squirrel code, it is just a xml file with description of UI elements. Search the code of the scriptedwizard plugin to see how it works, unfortunately this is the best documentation. :(

Do you know if there is already a predefined page with a list box style selector for multiple selection...
I don't know unfortunately.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 55
Re: Adding a new project type for a new embedded device/board
« Reply #5 on: November 09, 2018, 05:21:33 pm »
Been getting on quite well with this, my wizard creates an embedded project, copies require .c and .h files to the projects, sets up the compiler etc (ARM M0)

But a bit confused by some assembler files (not inline) that will need to be added to the project. If these are named .s does copying them to the project mean they are automatically added for assembly rather than compilation? Do I need to do anything else to make the project build sucessfully when it contains .s files?

I cannot actually try this out at the moment as this is preliminary work without some support I need, so would apreciate any hints.

Jimbo.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Adding a new project type for a new embedded device/board
« Reply #6 on: November 09, 2018, 07:05:44 pm »
I'm not sure if C::B knows how to compile assembler files, probably it doesn't. It is something which is often requested. So it probably could be added.

You can check this page: http://wiki.codeblocks.org/index.php/Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

You can try this even if you don't have all the pieces.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jimbo

  • Multiple posting newcomer
  • *
  • Posts: 55
Re: Adding a new project type for a new embedded device/board
« Reply #7 on: November 10, 2018, 12:10:08 pm »
Thanks,will take a look Monday.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Adding a new project type for a new embedded device/board
« Reply #8 on: November 10, 2018, 11:30:04 pm »
codeblocks should handle s files automatically, at least the avr compiler does...