Author Topic: Import for STM32CubeIDE  (Read 3533 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Import for STM32CubeIDE
« on: March 21, 2022, 05:59:01 pm »
Hi,
i would like to write an Importer for STM32CubeIDE projects to codeblocks. This is an IDE for ARM micro controllers of ST technology. They are quite popular and i use them also quite a lot. The IDE is not so my favorite so why not use codeblocks....

I have looked into it and it seems to be straight forward.

My initial idea is to use a script from the new project wizard. For this i have already written an XML script binding and i will probably upload it later this week.

But now i have a problem and would like to hear some ideas how to solve it:
From time to time it will be necessary to recreate or update the codeblocks Project from the STM32CubeIDE project file, so when the STM32CubeIDE project file changes on disk there should be a reloading (if possible automatically) from codeblocks.

I would like to keep the implementation in squirrel scripting, so it is easier to deploy the plugin on different OSes

1) With the scripting wizard i have no possibility to register some "reload" event that is triggered when a file on disk changes
2) With scripting in general i have no possibility to "register" such events.

One idea was to add a "script" section to the project file that would be executed on project loading. Sou you could create a script that registers an file listener and reruns the import, but i really do not like this idea...

Any other, less intrusive ideas?

Offline jordi

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Import for STM32CubeIDE
« Reply #1 on: March 21, 2022, 10:27:24 pm »
Hi,
Could you create a code::blocks project in the directory where STM32CubeIDE has generated the code? In this way, when code is regenerated from STM32CubeIDE, code::blocks ask you for reload whether the file is opened in the editor.
Regards

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Import for STM32CubeIDE
« Reply #2 on: March 22, 2022, 03:04:15 am »
I have no idea if this would work or not once implemented, but how about something like the following:
  • Add the STM project file to the project , but exclude it from the compilation
  • Add a few new file attributes for a file that makes up the project or sub XML tags
  • One of the new attribute/tag would cause a watch process to be triggered that watches for changes to the file.
  • Once a change in the file is detected another attribute/tag would indicate what is to be done due to the file changing.
Sounds like the CBP file XML snippet could be like the following (okay you would not have both the <squirrelscript>lines:
Code
        

<Unit filename="STMProject.prj">
    <Option compile="0" />
    <Option link="0" />
    <changedetected>
        <squirrelscript filename="file name to run on change detected " />
        <squirrelscript script="script code to run on change detected " />
    </changedetected>
</Unit>
How does this sound?
« Last Edit: March 22, 2022, 03:07:25 am by AndrewCot »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Import for STM32CubeIDE
« Reply #3 on: March 22, 2022, 09:19:40 am »
I like this. Instead of script we can use normal macro replacement and so the user can also run normal cmd commands. We probably have to add some macro that indicates the current changed file, but this should not be a problem.
The UI would be placed in the file property dialog and it would not be to bad to implement. The file reloading is implemented anyway, and running a command in this would not be to hard...

I will look into it.
Some objections from someone?

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Import for STM32CubeIDE
« Reply #4 on: March 22, 2022, 09:59:03 am »
When you get further along can you supply a sample of what you think it may look like? (The project file changes, not any GUI or script changes)