Skip to content

Issue#129#237

Merged
jkrech merged 15 commits into
mainfrom
issue#129
Oct 24, 2025
Merged

Issue#129#237
jkrech merged 15 commits into
mainfrom
issue#129

Conversation

@bgn42
Copy link
Copy Markdown
Collaborator

@bgn42 bgn42 commented Oct 17, 2025

Fixes

#129

Changes

now adds sources of ThirdPartyIp section of .mxproject

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Oct 17, 2025

Diff Coverage: The code coverage on the diff in this pull request is 80.3%.

Total Coverage: This PR will increase coverage by 14.26%.

File Coverage Changes
Path File Coverage Δ Indirect
internal/common/common.go -1.1
internal/stm32CubeMX/iniReader.go 71.1
internal/stm32CubeMX/mxDevice.go -0.3
internal/stm32CubeMX/stm32CubeMX.go 22.9
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 17, 2025

Test Results

    6 files  ±  0     54 suites  ±0   13s ⏱️ ±0s
  219 tests + 39    219 ✅ + 39  0 💤 ±0  0 ❌ ±0 
1 314 runs  +234  1 314 ✅ +234  0 💤 ±0  0 ❌ ±0 

Results for commit 6a2b88e. ± Comparison against base commit e088bed.

♻️ This comment has been updated with latest results.

@bgn42 bgn42 requested a review from Copilot October 17, 2025 21:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issue #129 by adding support for parsing and including source files from the ThirdPartyIp section of .mxproject files. The implementation adds a new ThirdPartyIqFiles struct to store third-party IP includes, source files, and assembly files, which are then written to the generated CGEN YAML output.

Key changes:

  • Added parsing logic for ThirdPartyIp sections in .mxproject files
  • Extended the CGEN YAML generation to include a new "ThirdParty" group with associated files
  • Added comprehensive unit tests for the new functionality

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vcpkg-configuration.json Added vcpkg configuration with ARM toolchain and compiler dependencies
testdata/testExamples/STM32H7_SC/STM32CubeMX/device/MX_Device/MX_Device.h Updated timestamp in generated device header
testdata/testExamples/STM32F2/RTE/Device/STM32F217IGHx/regions_STM32F217IGHx.h Added new regions configuration header for STM32F2 device
testdata/testExamples/STM32F2/RTE/Device/STM32F217IGHx/ac6_linker_script.sct.src Added new AC6 linker script template for STM32F2 device
testdata/stm32cubemx/cfg/MX_Device.h Added new test device header file
internal/stm32CubeMX/stm32CubeMX_test.go Added comprehensive tests for WriteProjectFile function
internal/stm32CubeMX/stm32CubeMX.go Added logic to append ThirdParty group with files to CGEN output
internal/stm32CubeMX/iniReader_test.go Added tests for GetData function covering ThirdPartyIp parsing
internal/stm32CubeMX/iniReader.go Added ThirdPartyIqFiles struct and parsing logic for ThirdPartyIp sections
internal/readFile/readFile.go Added comments and fixed path reference for STM32CubeMX.ioc
internal/common/common.go Added missing error return statement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread internal/stm32CubeMX/iniReader.go
Comment thread internal/stm32CubeMX/iniReader_test.go Outdated
Comment thread internal/stm32CubeMX/iniReader_test.go Outdated
@bgn42 bgn42 requested review from DavidLesnjak and jkrech October 17, 2025 21:39
Copy link
Copy Markdown
Member

@jkrech jkrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation does not work for me as the files are not correctly specified relative to the cgen.yml file:

File location
STM32CubeMX\STM32F423VHTx\STM32CubeMX\Middlewares\ST\threadx\common\src\tx_initialize_high_level.c

currently specified in *.cgen.yml
../Middlewares/ST/threadx/common/src/tx_initialize_high_level.c

should read:

./STM32CubeMX/Middlewares/ST/threadx/common/src/tx_initialize_high_level.c

After patching the cgen.yml all specified filed were found. But linking is still missing symbols.

@brondani thanks for the investigation. It seems we are missing files from mxproject in the cgen.yml file:

       - file: ./STM32CubeMX/Middlewares/ST/threadx/common/src/tx_thread_system_suspend.c
       - file: ./STM32CubeMX/Middlewares/ST/threadx/common/src/tx_thread_system_resume.c
       - file: ./STM32CubeMX/Middlewares/ST/threadx/common/src/tx_thread_system_preempt_check.c
       - file: ./STM32CubeMX/Middlewares/ST/threadx/common/src/tx_timer_system_activate.c
       - file: ./STM32CubeMX/Middlewares/ST/threadx/common/src/tx_timer_system_deactivate.c

Another observation is that RW_IRAM1 is not in the default linker script, however I think we need to configure to use the linker script from STCube which needs to be added manually?

@bgn42 can you please compare all files listed in .mxproject and cgen.yml

Copy link
Copy Markdown
Collaborator

@DavidLesnjak DavidLesnjak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t have a chance yet to deeply analyze the code changes, but I did test the cbridge artifact using STM32CubeMX 6.15 with the STM32F769I-DISCO board.
In my test project, I enabled FatFS, FreeRTOS, and USB Audio middleware components.

Please take a look at the attached input files (.ioc and .mxproject) and the generated output cgen.yml.
You can notice that all third-party sources (FreeRTOS, FatFS, and USB) are currently listed under the CubeMX group, while the ThirdParty group is empty — which leads to a schema validation error.

I would expect that these third-party files are listed under the ThirdParty group instead.
Actually, I’d suggest going a step further and splitting the ThirdParty group into multiple groups, one per individual third-party component (e.g., FreeRTOS, FatFS, USB, etc.). This would improve clarity and structure.

It’s also worth considering that the .mxproject file might be generated differently for different STM32 families or depending on which third-party components are enabled. Some investigation may be needed to understand how third parties are represented in .ioc and .mxproject files across device families.

I recommend updating the STM32CubeMX projects in testData/testExamples to include configurations that enable various third-party components.
Additional tests could then be added that generate cgen.yml from these examples and compare the results against reference outputs.

Blinky.cgen.yml
_mxproject.txt
STM32CubeMX_ioc.txt

@bgn42
Copy link
Copy Markdown
Collaborator Author

bgn42 commented Oct 22, 2025

@DavidLesnjak , in your case there is no ThirdParty-Section in .mxproject, all files are in the [PreviousUsedKeilFiles]. cbridge cannot know that these should be moved to a new section. But, cbridge should not create an ampty ThirdParty group in cgen.yml.
Another problem, maybe, is, if there are multiple ThirdPartyIp sections in .mxproject. I do not know how to cope with them in cgen.yml.

bgn42 added 2 commits October 22, 2025 15:15
…d party part from vendor and version creating multiple groups. Removed filter of file names from third party files. Changed filter "system_" to "system_stm32"
@bgn42 bgn42 requested a review from Copilot October 22, 2025 13:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread internal/stm32CubeMX/stm32CubeMX.go
Comment thread internal/readFile/readFile.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bgn42 bgn42 requested a review from jkrech October 22, 2025 13:40
Copy link
Copy Markdown
Member

@jkrech jkrech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jkrech jkrech merged commit 919f2e6 into main Oct 24, 2025
25 checks passed
@jkrech jkrech deleted the issue#129 branch October 24, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants