Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update toolchain-gccarmnoneeabi for SKR Mini E3 V3/3.0.1, Manta Series, & EBB42 #26320

Conversation

thisiskeithb
Copy link
Member

@thisiskeithb thisiskeithb commented Oct 2, 2023

Description

Compiling for an SKR Mini E3 V3, V3.0.1, Manta Series, or BTT EBB42 V1.1, you get the following error:

Compiling .pio/build/STM32G0B1RE_btt/SrcWrapper/src/stm32/pinmap.c.o
/.platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src/stm32/clock.c: In function 'enableClock':
/.platformio/packages/framework-arduinoststm32/libraries/SrcWrapper/src/stm32/clock.c:135:7: error: a label can only be part of a statement and a declaration is not a statement
  135 |       uint32_t HSEState = RCC_HSE_ON;
      |       ^~~~~~~~

This is due to using toolchain-gccarmnoneeabi@1.100301.220327. Updating to toolchain-gccarmnoneeabi@1.120301.0 fixes the compile error, but creates a new warning:

/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: warning: .pio/build/STM32G0B1RE_btt/firmware.elf has a LOAD segment with RWX permissions

That can be silenced with a -Wl,--no-warn-rwx-segment build flag (source), but I'm not sure if that's the best way to handle it.

Requirements

SKR Mini E3 V3, V3.0.1, Manta Series, or BTT EBB42 V1.1

Benefits

Allows users to compile for these boards again.

Configurations

MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-3/BigTreeTech SKR Mini E3 3.0

Related Issues

@thisiskeithb
Copy link
Member Author

thisiskeithb commented Oct 2, 2023

Alternatively, I could have pinned framework-arduinoststm32 to https://github.com/stm32duino/Arduino_Core_STM32/tree/0c69f378ddf18937fdbdb1f26f61e1308ac7ad51 (the commit prior to when things broke), but this way was easier since I didn't have to modify our generic_create_variant.py script to add the commit hash.

@thisiskeithb thisiskeithb changed the title Update toolchain-gccarmnoneeabi for SKR Mini E3 V3/3.0.1 & EBB42 Update toolchain-gccarmnoneeabi for SKR Mini E3 V3/3.0.1, Manta M8P, & EBB42 Oct 2, 2023
@classicrocker883
Copy link
Contributor

classicrocker883 commented Oct 3, 2023

Alternatively, I could have pinned framework-arduinoststm32 to https://github.com/stm32duino/Arduino_Core_STM32/tree/0c69f378ddf18937fdbdb1f26f61e1308ac7ad51 (the commit prior to when things broke), but this way was easier since I didn't have to modify our generic_create_variant.py script to add the commit hash.

so things "broke" right after this commit made on Sept 1? IIRC, using the previous 12.2re1 tool chain had caused the error that could be silenced with -Wl,--no-warn-rwx-segment.

have you found out what exactly made things not work in the first place? or what change made things "fixed" for the most part?

edit:
this->commit here is the one in question.
even though this has already been referenced, here it is again....for reference.

@thisiskeithb
Copy link
Member Author

edit:
this->commit here is the one in question.

I literally linked to that in the PR description.

@classicrocker883
Copy link
Contributor

".platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe:"

give no help at all.
so I was asking if there are any leads as to pinpoint exactly?

i'm painstaking comparing each folder file by file. but ill just not waste my time.

@classicrocker883
Copy link
Contributor

classicrocker883 commented Oct 3, 2023

from this website

  • warning: has a LOAD segment with RWX permissions

This warning indicates that there are one or more vulnerable segments. These segments can be found by running the readelf program like this:

readelf -lW < file >
Note: In readelf’s output, the executable flag for segments is labeled as E rather than X, so look for RWE rather than RWX.

$ readelf -lW firmware-20231002-235514.elf | grep RWE
  LOAD           0x001000 0x08002000 0x08002000 0x36a80 0x36a80 RWE 0x1000

firmware-20231002-235514.zip

honestly I am not exactly sure where to go from here. I'll need to output that address to see what the warning is linked to.
then I would be able to backtrack to where the package framework file/code is and see what can be done then. otherwise would it just be easier to completely silence the warning with -Wl,--no-warn-rwx-segment??

none-the-less I'm interested in finding what the warning pertains to.

@classicrocker883
Copy link
Contributor

Update

I would disregard the whole trying to fix the warning thing. and use -Wl,--no-warn-rwx-segment as a build flag.

--no-warn-rwx-segment was added to the more recent toolchain, so toolchain-gccarmnoneeabi@1.100301.220327 doesnt even have the warning available.
when using readelf for the compilation using the previous 10.3.1 toolchain, this is the output

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x08000000 0x08000000 0x39420 0x39420 RWE 0x10000

basically the same RWE flag is present. that is all what causes the (RWX) warning. meaning if program headers give a flag more than RW, like we see RWE (X being a variable), that's all that it means. It's is informing us that we get R+W+E. so thats all.

Copy link
Contributor

@classicrocker883 classicrocker883 left a comment

Choose a reason for hiding this comment

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

I would add
-Wl,--no-warn-rwx-segment

@thisiskeithb thisiskeithb force-pushed the pr/Update-toolchain-gccarmnoneeabiforSKRMiniE3V3-3.0.1-EBB42 branch from f37ac82 to 7c92c75 Compare October 4, 2023 19:07
Prevent "warning: /firmware.elf has a LOAD segment with RWX permissions"
@thisiskeithb thisiskeithb changed the title Update toolchain-gccarmnoneeabi for SKR Mini E3 V3/3.0.1, Manta M8P, & EBB42 Update toolchain-gccarmnoneeabi for SKR Mini E3 V3/3.0.1, Manta Series, & EBB42 Oct 7, 2023
@thisiskeithb
Copy link
Member Author

This appears to be a macOS-specific issue with toolchain-gccarmnoneeabi@1.100301.220327 since CI/compiling under Linux no longer causes the same error: #26327

@thisiskeithb
Copy link
Member Author

Completely deleting the ~/.platformio/ folder instead of just /packages/ and /platforms/ was the fix apparently.

@thisiskeithb thisiskeithb deleted the pr/Update-toolchain-gccarmnoneeabiforSKRMiniE3V3-3.0.1-EBB42 branch October 7, 2023 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants