Author Topic: Am finishing an STM32 wizard and need some tips...  (Read 5873 times)

Offline Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Am finishing an STM32 wizard and need some tips...
« on: April 18, 2016, 06:49:25 pm »
I am about ready to make available a plugin 'wizard' for the STM32 family of ARM devices.  This plugin knows about the structure of the STM32 "Cube" libraries which expose the various API's supported by the manufacturer, plus some third-party 'middleware' for extra functionality.  The plugin will allow you to (for example)  1) select additional libraries in the cube; 2) enable HAL (hardware abstraction) functionality as needed and perform *some* of the initialization required; 3) enable FreeRTOS and hook up timers etc; 4) build a project containing all of the needed components copied from the CUBE into the user's project directory.  It's well enough along I'm currently using it in a limited production basis for build test applications for some new hardware.

My wizard and other changes have been tracking the currently nightlies without incident so I don't expect much integration fuzz to get this installed.  Unfortunately, as my plugin requires the extra wizard api exposure, I can't just release this as an 'addon' (though I do believe my additions should make some more complex wizards possible at a later date, and for me the Squirrel approach seems saner than writing a bunch of C code that needs to be validated under a bunch of other platforms I don't / can't run.

And I can make my patches (against the current nightly build) if someone else wants to see what I've been doing.  I don't have a document yet describing what I've done (with the APIs that have been added) but that should be coming soon.

My current issue is a desire to establish some project-defined openocd configuration to enable debugging after the wizard has completed.  I know from past conversations with a few folks here the GDB functionality may be in a state of 'flux' so didn't want to start tipping the cart with my own mods before asking about any 'road map.'  Does anyone have suggestions as to what best course to take for this mechanism.

Thanks for listening,

-Gary

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11040
    • Travis build status
Re: Am finishing an STM32 wizard and need some tips...
« Reply #1 on: April 18, 2016, 07:35:17 pm »
Please post patches about the wizard.

About debugging: Can you describe the problem with more details?
(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 Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #2 on: April 18, 2016, 07:54:13 pm »
I would but ran into a small snag (am researching but haven't found the solution yet): How do I post a patch with a .png (binary) file in it?  I'm so used to git I forgot about this issue with svn...
Does the C::B project have a 'best practice' on this issue? 

The 'debug' problem is only that I would like to pre-populate the project's 'debugger' configuration with the GDB parameters for connecting to opencdb (target remote etc.)  openocd uses a different port than other gdb debug shims, so anything in the top-leve processor-specific debugger configuration wouldn't apply.

-Gary

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11040
    • Travis build status
Re: Am finishing an STM32 wizard and need some tips...
« Reply #3 on: April 18, 2016, 08:02:45 pm »
I would but ran into a small snag (am researching but haven't found the solution yet): How do I post a patch with a .png (binary) file in it?  I'm so used to git I forgot about this issue with svn...
Does the C::B project have a 'best practice' on this issue? 
I can apply git patches. Don't remember how it is done with svn, probably the internet knows.

The 'debug' problem is only that I would like to pre-populate the project's 'debugger' configuration with the GDB parameters for connecting to opencdb (target remote etc.)  openocd uses a different port than other gdb debug shims, so anything in the top-leve processor-specific debugger configuration wouldn't apply.
I think, I've fixed this no long ago. It should be possible to set the settings of the debugger using scripting. But I might be wrong.
If you give me a link to a previous discussion I might remember:)
(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 Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #4 on: April 18, 2016, 08:13:09 pm »
I'm looking through google et al for tips - found references to using git to import svn to generate a git patch (which does know about binary bits) but of course that fails with an error: 'tempfile' can't be called as a method at /usr/local/share/perl/5.12.4/Git.pm line 1042.

I am now digging through the scriptmanager stuff (been through this a bunch lately) and don't remember anything specific for debug setup, but if it's there I will find it :-)

As soon as that part is resolved, I'll post the diffs.  They are rather largish (13k + lines) with mostly in the wizard and support 'include' scripts - I broke the script into four pieces because maintiaining one LARGE script seems tedious - four smaller 'modules' made more sense and I might break it down further.  As I stated, this is a complex script and includes (among other things) serialization of configuration to the user's .config/codeblocks/ area to save state so I don't have to grok through the STM32_CUBE modules over an over.  (The serialization is a simple 'write config' / 'read config' that allows storing arbitrary data into an isolated 'jail' in the codeblocks configuration folder - not the project folder.  I wrote a Squirrel data-structure dumper so I can serial Squirrel objects and then reload them later.  Makes the loading configuration about 1000x faster than re-reading the files in the STM32 CUBE folders.

I'll be back as soon as I fix the diff issue - do I post the patches here or do you want a link to my owncloud storage?

Thanks!
-Gary

Offline Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #5 on: April 18, 2016, 08:56:36 pm »
Patch problem resoved.  Using tips from http://stackoverflow.com/questions/159853/subversion-diff-including-new-files:

svn diff --force --diff-cmd /usr/bin/diff -x -au

Will be uploading patches this afternoon after my lunch break.

-Gary

Offline Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #6 on: April 18, 2016, 10:59:01 pm »
README file for what has changed (a brief outline) is at
https://filebox.aerodesic.net/owncloud/public.php?service=files&t=6fe7a980354d5d66e7501d1da3b916e4

The patches (made against current SVN earlier this morning:)

https://filebox.aerodesic.net/owncloud/public.php?service=files&t=96bc9bb3e7efc52617644bd4f598c7d6

If you have problems accessing these, let me know and I'll just post the raw stuff here.

-Gary

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11040
    • Travis build status
Re: Am finishing an STM32 wizard and need some tips...
« Reply #7 on: April 19, 2016, 12:05:21 am »
Why don't you attach the patch here or in the tickets section in our project page on sf.net?
What is the file format of the patch?
I can't read the .diff file it some binary, but it is not a zip, nor tar, so what is it?
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11040
    • Travis build status
Re: Am finishing an STM32 wizard and need some tips...
« Reply #8 on: April 19, 2016, 12:10:31 am »
As soon as that part is resolved, I'll post the diffs.  They are rather largish (13k + lines) with mostly in the wizard and support 'include' scripts - I broke the script into four pieces because maintiaining one LARGE script seems tedious - four smaller 'modules' made more sense and I might break it down further.  As I stated, this is a complex script and includes (among other things) serialization of configuration to the user's .config/codeblocks/ area to save state so I don't have to grok through the STM32_CUBE modules over an over.  (The serialization is a simple 'write config' / 'read config' that allows storing arbitrary data into an isolated 'jail' in the codeblocks configuration folder - not the project folder.  I wrote a Squirrel data-structure dumper so I can serial Squirrel objects and then reload them later.  Makes the loading configuration about 1000x faster than re-reading the files in the STM32 CUBE folders.

BTW I'm interested in patches to the scripting bindings of C::B only.
If the script is as complex as you describe it, I'll prefer if it stays as a separate project and not part of C::B.
The reason is that there will be very few people using it and none of the core developers will maintain it properly.

As a separate project it can have faster iterations and better support.
I'm eager to help with improvements to C::B to facilitate easier integration, installation and setup.

Hopefully this sounds reasonable to you.

p.s. I'm maintaining the arduino wizards in a similar fashion (no matter that a different version has been added to the main install). https://github.com/obfuscated/cb_arduino_template
p.p.s. You can use my git repo to post patches against. It is relatively up-to-date.
« Last Edit: April 19, 2016, 12:12:25 am by oBFusCATed »
(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 Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #9 on: April 19, 2016, 12:53:48 am »
erested in patches to the scripting bindings of C::B only.
If the script is as complex as you describe it, I'll prefer if it stays as a separate project and not part of C::B.
The reason is that there will be very few people using it and none of the core developers will maintain it properly.

As a separate project it can have faster iterations and better support.
I'm eager to help with improvements to C::B to facilitate easier integration, installation and setup.

Hopefully this sounds reasonable to you.

p.s. I'm maintaining the arduino wizards in a similar fashion (no matter that a different version has been added to the main install). https://github.com/obfuscated/cb_arduino_template
p.p.s. You can use my git repo to post patches against. It is relatively up-to-date.

Sounds completely reasonable.  The diff is producted with the command I sent in an earlier post - it DOES contain some binary since it used the 'real' diff to allow 'patching' in the two .png files.  Without those files, the base diffs should be simpler and no binary.  I will post those to the sf as soon as I make sure I'm going it right... Been a while since I've submitted anything there.  I can post back here once that's complete.

Roger the patching against the git repo.  I've been messing with this script for a few months, and not ONCE have I had a patch collision...  Not much going on in the areas I was touching.

Gary

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11040
    • Travis build status
Re: Am finishing an STM32 wizard and need some tips...
« Reply #10 on: April 19, 2016, 01:44:32 am »
OK, seems like less got confused by this patch... I can open it in scite.
(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 Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #11 on: April 19, 2016, 02:43:32 am »
OK.  Posted to sf.net (without stm32 stuff.)  Also postted to aerodesic/codeblocks_stm32_wizard on github.  First time with github so may not have everything set up ok, but at least I've 'shared' now  ;)

Will try to keep the repo up-to-date with changes.  Lots to come as I flesh out the other processors and Middleware components.

-Gary

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Am finishing an STM32 wizard and need some tips...
« Reply #12 on: April 20, 2016, 03:27:12 pm »
I am about ready to make available a plugin 'wizard' for the STM32 family of ARM devices.  This plugin knows about the structure of the STM32 "Cube" libraries which expose the various API's supported by the manufacturer, plus some third-party 'middleware' for extra functionality.  The plugin will allow you to (for example)  1) select additional libraries in the cube; 2) enable HAL (hardware abstraction) functionality as needed and perform *some* of the initialization required; 3) enable FreeRTOS and hook up timers etc; 4) build a project containing all of the needed components copied from the CUBE into the user's project directory.  It's well enough along I'm currently using it in a limited production basis for build test applications for some new hardware.

This is funny :)

I have recently (like, during the last couple of weeks) coded a script for importing a Cube project file (*.gpdsc) to C::B.
In doing so, I also added support for XML parsing (rudimentary, what wxXML provides) in scripts.
I also had to add a "Custom command" (besides serial/network) entry in remote debugger connection settings that allows you to open a pipe to openocd from inside gdb.
All above changes live locally on my disk, not committed yet.

Is what you implemented anywhere accessible so I can have a look?
Be patient!
This bug will be fixed soon...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11040
    • Travis build status
Re: Am finishing an STM32 wizard and need some tips...
« Reply #13 on: April 20, 2016, 07:00:26 pm »
@mandrav: https://sourceforge.net/p/codeblocks/tickets/341/

Also please don't make changes to the scripting at the moment, because there is a sqplus to scrat migration changes that ought to be applied soon.
(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 Aerodesic

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Am finishing an STM32 wizard and need some tips...
« Reply #14 on: April 25, 2016, 06:23:51 pm »

This is funny :)

I have recently (like, during the last couple of weeks) coded a script for importing a Cube project file (*.gpdsc) to C::B.
In doing so, I also added support for XML parsing (rudimentary, what wxXML provides) in scripts.
I also had to add a "Custom command" (besides serial/network) entry in remote debugger connection settings that allows you to open a pipe to openocd from inside gdb.
All above changes live locally on my disk, not committed yet.

Is what you implemented anywhere accessible so I can have a look?

Up on github:

https://github.com/aerodesic/codeblocks_stm32_wizard.git

Be aware this is a rather large plugin and it involved adding a bunch of squirrel-to-wx bindings to get
the display elements I needed.  Also, many of the processor information tables are incomplete.
(as of course, is the documentation :-)

I am, however, using it in limited production (with my other C::B modifications, so lots of it works.
-Gary