unleashed-firmware/documentation/HardwareTargets.md
Astra ecab4d53d2
[FL-870] Auto-generated firmware documentation take two (#2944)
* Add doxygen and doxygen-awesome css, cleanup docs files
* Ignore more libraries and remove leftover local variables
* Create an actual intro page
* .md files linting
* Add doxygen action
* Fix Doxygen path
* Fix doxyfile path
* Try to upload
* Change docs branch
* Add submudules checkout
* Disable doxygen on PR
* Mention the firmware docs in the readme
* More dev docs mentions in the readme
* Fix runner group, add tags
* Test dev in PR
* Disable running on PR
* Fix a typo in the doxyfile
* Try upload to S3
* Fix local path
* Fix S3 ACL
* Add delete flag, unifying dev and tags
* Update ignored directories
* More ignored directories
* Even more ignored directories
* Fix submodule
* Change S3 uploader
* Change S3 uploader version
* Fix aws sync flags
* Fix ACL
* Disable ACL
* Improve ignores, add WiFi devboard docs
* TEMP: generate dev docs
* TEMP: generate 0.89.0 docs
* Disabling PR trigger
* Enable submodules and test build
* Enable test build
* Disable test build
* Change docs directory structure
* Fix accidentally committed submodule
* Fix submodules
* Update links to the developer documentation
* Markdown linting
* Update workflow, enable test build
* Fix doxygen dir path
* Update Doxyfile-awesome.cfg
* Change paths
* Fix upload docs path
* Disable pull_request debug trigger
* Disable tags building
* Remove autolinks and namespaces
* Establish basic documentation structure
* Add missing changes
* Improve stylesheet, move some files
* Improve examples
* Improve the main page
* Improve application dev docs
* Improve system programming docs
* Improve development tools docs
* Improve other docs
* Improve application examples
* Fix formatting
* Fix PVS-studio warnings
* Improve visuals
* Fix doxygen syntax warnings
* Fix broken links
* Update doxygen action

Co-authored-by: DrunkBatya <drunkbatya.js@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com>
2024-03-06 15:25:21 +09:00

3.2 KiB

What a Firmware Target is

Flipper's firmware is modular and supports different hardware configurations in a common code base. It encapsulates hardware-specific differences in furi_hal, board initialization code, linker files, SDK data and other information in a target definition.

Target-specific files are placed in a single sub-folder in targets. It must contain a target definition file, target.json, and may contain other files if they are referenced by current target's definition. By default, fbt gathers all source files in target folder, unless they are explicitly excluded.

Targets can inherit most code parts from other targets, to reduce common code duplication.

Target Definition File

A target definition file, target.json, is a JSON file that can contain the following fields:

  • include_paths: list of strings, folder paths relative to current target folder to add to global C/C++ header path lookup list.
  • sdk_header_paths: list of strings, folder paths relative to current target folder to gather headers from for including in SDK.
  • startup_script: filename of a startup script, performing initial hardware initialization.
  • linker_script_flash: filename of a linker script for creating the main firmware image.
  • linker_script_ram: filename of a linker script to use in "updater" build configuration.
  • linker_script_app: filename of a linker script to use for linking .fap files.
  • sdk_symbols: filename of a .csv file containing current SDK configuration for this target.
  • linker_dependencies: list of libraries to link the firmware with. Note that those not in the list won't be built by fbt. Also several link passes might be needed, in such case you may need to specify same library name twice.
  • inherit: string, specifies hardware target to borrow main configuration from. Current configuration may specify additional values for parameters that are lists of strings, or override values that are not lists.
  • excluded_sources: list of filenames from the inherited configuration(s) NOT to be built.
  • excluded_headers: list of headers from the inherited configuration(s) NOT to be included in generated SDK.
  • excluded_modules: list of strings specifying fbt library (module) names to exclude from being used to configure build environment.

Applications & Hardware

Not all applications are available on different hardware targets.

  • For applications built into the firmware, you have to specify a compatible application set using FIRMWARE_APP_SET=... fbt option. See fbt docs for details on build configurations.

  • For applications built as external .faps, you have to explicitly specify compatible targets in application's manifest, application.fam. For example, to limit application to a single target, add targets=["f7"], to the manifest. It won't be built for other targets.

For details on application manifests, check out their docs page.

Building Firmware for a Specific Target

You have to specify TARGET_HW (and, optionally, FIRMWARE_APP_SET) for fbt to build firmware for non-default target. For example, building and flashing debug firmware for f18 can be done with

./fbt TARGET_HW=18 flash_usb_full