Skip to content

Precompiled libs feature doesn't account for floating point mcu variants #256

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

Closed
kgoveas opened this issue Nov 30, 2017 · 6 comments · Fixed by arduino/arduino-cli#512
Closed
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself

Comments

@kgoveas
Copy link

kgoveas commented Nov 30, 2017

Hi

The precompiled libs fix for the arduino builder doesn't account for the floating point unit variants of the mcu. Example: {build.mcu} = cortex-m4 but there are 2 variants of the MCU. With floating point and without floating point.

Unfortunately i have no input for how to know which mcu variant is in use. But the ldflags would be found in cortex-m4 or cortex-m4f.

@facchinm
Copy link
Member

facchinm commented Dec 1, 2017

Hi @kgoveas ,
you are right, I didn't think about this case.
What about using the multilib approach from this table (https://stackoverflow.com/a/25728024) ?

@kgoveas
Copy link
Author

kgoveas commented Dec 1, 2017

Hi @facchinm ,

Do you mean like a folder structure like cortex-m4, cortex-m4-sfp, cortex-m4-hfp? If so, what references would you use from the platform.txt file apart from the {build.mcu}?

@facchinm
Copy link
Member

facchinm commented Dec 4, 2017

Probably {build.mfloat-abi} is the only way to extract that information but it must be declared in board.txt and not directly on the commandline... It's a bit awkward but the most effective thing to do could be creating two different libraries (one for hardfloat variant) and including them selectively (maybe with #error pragmas to make it clear for the user that the library he specified is not compatible with the selected target)

@kgoveas
Copy link
Author

kgoveas commented Dec 4, 2017

How about using {build.arch} instead? It would create duplicates in case of archs that share the same MCU but it would also synchronize with the warning that would appear in the Arduino IDE.

@facchinm
Copy link
Member

Ok, I had some time to take a look at the issue; the correct approach is probably the one adopted by STM32 core, which specifies all the information in build.mcu(https://github.com/stm32duino/Arduino_Core_STM32/blob/master/boards.txt#L133). This will totally work, although the folder name will be horrible.
Extracting the various parameters from the generated commandline would make things much more difficult. What to you think about it?

@kgoveas
Copy link
Author

kgoveas commented Mar 18, 2018

Hi @facchinm ,

Yes, i guess this would work. I had come across this while testing on the STM32F411RE board.

@facchinm facchinm self-assigned this Apr 11, 2018
facchinm added a commit to facchinm/arduino-cli that referenced this issue Dec 11, 2019
General change:
 - library compilation bails out if the precompiled object is found.
   This allows mixed libraries that fallback using sources if no suitable precompiled object is found

ARM float specification change:
 - Cortex M4+ allows specifying different flags for floating point ABI
   This patch introduces a second level of subfolder that MUST be used is -mfpu or -mfloat-abi are specified on the commandline
   Since there's no clear specification (unlike build.mcu), the values are extracted from c++ recipe

   For example, for a target which commandline contains `-mfloat-abi=hard -mfpu=fpv4-sp-d16` , the precompiled search path will be
   `$libfolder/cortex-m4/fpv4-sp-d16-hard`
   If that folder doesn't exist the library will be compiled from sources

Fixes arduino/arduino-builder#256
cmaglie pushed a commit to arduino/arduino-cli that referenced this issue Feb 11, 2020
General change:
 - library compilation bails out if the precompiled object is found.
   This allows mixed libraries that fallback using sources if no suitable precompiled object is found

ARM float specification change:
 - Cortex M4+ allows specifying different flags for floating point ABI
   This patch introduces a second level of subfolder that MUST be used is -mfpu or -mfloat-abi are specified on the commandline
   Since there's no clear specification (unlike build.mcu), the values are extracted from c++ recipe

   For example, for a target which commandline contains `-mfloat-abi=hard -mfpu=fpv4-sp-d16` , the precompiled search path will be
   `$libfolder/cortex-m4/fpv4-sp-d16-hard`
   If that folder doesn't exist the library will be compiled from sources

Fixes arduino/arduino-builder#256
@per1234 per1234 added conclusion: resolved Issue was resolved topic: code Related to content of the project itself labels Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants