Skip to content

Commit e6f8274

Browse files
authored
[skip changelog] Document floating point ABI configuration folders for precompiled libraries (#833)
* Move precompiled library file location documentation to dedicated section of library specification As more documentation is added about precompiled libraries, it becomes increasingly awkward to fit in in the bullet list format of the library.properties fields section of the library specification. The specification has a dedicated "Layout of folders and files" section, which is an appropriate place to move the documentation of the precompiled binary files used with this feature. This allows the documentation of the `precompiled` library.properties field to be only about the use of that field, with a link to the section which contains the documentation about the files. * Document floating point ABI configuration folders for precompiled libraries
1 parent 45cec73 commit e6f8274

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

Diff for: docs/library-specification.md

+41-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ otherwise below, **all fields are required**. The available fields are:
8383
sketch as `#include <...>` lines. This property is used with the "Include library" command in the Arduino IDE. If the
8484
`includes` property is missing, all the header files (.h) on the root source folder are included.
8585
- **precompiled** - **(available from Arduino IDE 1.8.6/arduino-builder 1.4.0)** (optional) enables support for .a
86-
(archive) and .so (shared object) files. The .a/.so file must be located at `src/{build.mcu}` where `{build.mcu}` is
87-
the architecture name of the target the file was compiled for. Ex: `cortex-m3` for the Arduino DUE. The static library
88-
should be linked as an ldflag. The **precompiled** field has two supported values, which control how any source files
89-
in the library are handled:
86+
(archive) and .so (shared object) files. See the ["Precompiled binaries"](#precompiled-binaries) section for
87+
documentation of the required location in the library for these files. The static library should be linked as an
88+
ldflag. The **precompiled** field has two supported values, which control how any source files in the library are
89+
handled:
9090
- true - Source files are always compiled. This is useful for "mixed" libraries, such as those that contain both open
9191
source code and the precompiled binary of a closed source component. Support for "mixed" libraries was inadvertently
9292
lost in Arduino IDE 1.8.12/arduino-builder 1.5.2/Arduino CLI 0.8.0, and returned in Arduino IDE
@@ -154,6 +154,43 @@ only needs to run on Arduino IDE 1.5.x+, we recommend placing all source code in
154154
recursive compilation of nested source folders, its code must be in the src/ folder (since Arduino IDE 1.0.x doesn’t
155155
support recursive compilation, backwards compatibility wouldn’t be possible anyway).
156156

157+
#### Precompiled binaries
158+
159+
The `precompiled` field of [library.properties](#libraryproperties-file-format) enables support for the use of
160+
precompiled libraries. This requires providing .a (archive) or .so (shared object) files which are compiled for a
161+
particular processor architecture. The target architecture of the files is indicated by folder names.
162+
163+
The binaries must be located at `src/{build.mcu}`, where `{build.mcu}` is the architecture name of the target the file
164+
was compiled for. Ex: `cortex-m3` for the Arduino Due.
165+
166+
The filenames of the compiled binaries should start with `lib` (e.g., `libFoo.a`).
167+
168+
**(available from Arduino IDE 1.8.12/arduino-builder 1.5.2/Arduino CLI 0.8.0)** The floating point ABI configuration of
169+
ARM core microcontrollers may be adjusted via compiler flags. An extra subfolder level can be used to provide files
170+
compiled for a specific floating point configuration: `src/{build.mcu}/{build.fpu}-{build.float-abi}`, where
171+
`{build.fpu}` is the value of the `-mfpu` compiler flag and `{build.float-abi}` is the value of the `-mfloat-abi`
172+
compiler flag. **(available from Arduino IDE 1.8.13/arduino-builder 1.5.3/Arduino CLI 0.11.0)** If floating point
173+
configuration flags are used but no folder matching that configuration is found, `src/{build.mcu}` is used as a
174+
fallback.
175+
176+
Below is an example library `src` folder structure that provides:
177+
178+
- Header file containing the declarations for the library API.
179+
- Source file to use as a fallback for other architectures (`precompiled=full` mode).
180+
- Archive file for the ARM Cortex M0+ architecture of the Arduino SAMD boards.
181+
- Archive file for the ARM Cortex M4 architecture of the Arduino Nano 33 BLE, as a fallback for backwards compatibility
182+
with Arduino development software before the floating point configuration support was added.
183+
- Archive file for the ARM Cortex M4 architecture of the Arduino Nano 33 BLE, compiled for the
184+
`-mfloat-abi=softfp -mfpu=fpv4-sp-d16` floating point ABI configuration.
185+
186+
```
187+
Servo/src/Servo.h
188+
Servo/src/Servo.cpp
189+
Servo/src/cortex-m0plus/libServo.a
190+
Servo/src/cortex-m4/libServo.a
191+
Servo/src/cortex-m4/fpv4-sp-d16-softfp/libServo.a
192+
```
193+
157194
#### Library Examples
158195

159196
Library examples must be placed in the **examples** folder. Note that the **examples** folder must be written exactly

0 commit comments

Comments
 (0)