1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-15 20:35:29 +03:00
inav/docs
Alberto García Hierro a5607bc54c Generate CLI settings at build time (#2028)
* Initial commit for the CLI settings compiler

Not very useful for now, only generates settings.c in the same
way the settings were manually written in cli.c

* Move all settings to a YAML file

This will eventually let us compile and pack the settings saving
a lot of memory. For now, the code compiles but it doesn't work
since it uses a byte to index into the word array which has more
than 256 entries.

* Use varint encoding for cli name word indexing

This makes the CLI work again.

* Make clivalue_name_* funcs return bool

Makes more sense than returning uint8_t, even when the compiler will
probably generate exactly the same assembly in both cases.

* Fix invalid field name

Missing a closing ]

* Initial attempt at generating the settings files at build time

Optimize the generator to call into the compiler only once, so
we can afford to call it for each build and, eventually, generate
build-optimized settings.

* Fix build error due to generated files

Due to make's expansion rules, the generated implementation file
wasn't correctly compiled if the build was started when the
generated files didn't exist.

Althogh there's probably a better solution, this should work for
now.

* Generate a per-build settings_generated.{h,c}

This allows us to save a bit more space, since this way the words
array doesn't include words which are not used by the build.

* Remove pgn_t field from cliValueConfig_t

Use a couple of arrays to find the pgn_t for a setting from its
offset in the table. This saves another 384 bytes on NAZE.

* Use only a byte for the field offset in clivalue_t when possible

While compiling the settings, determine if any offset requires a
number bigger than 255. If that's not the case, use a uint8_t
rather than an uint16_t for storing the field offset.

* Add missing header to PG_MODE_ACTIVATION_OPERATOR_CONFIG group

* Fix unbalanced #endif

Introduced when deleting the hardcoded settings from cli.c

* Don't ignore the return value from g.CanUseByteOffsetoff()

CLIVALUE_USE_BYTE_OFFSETOF was always defined regardless of the
maximum offsetof() value found in the settings.

* clivalue_name_*() functions now take a buffer

Requires only CLIVALUE_MAX_NAME_LENGTH bytes in the stack rather
than 2*CLIVALUE_MAX_NAME_LENGTH, since those functions were called
from functions which already had a buffer for the name allocated
but had to allocate their own.

* Remove unneeded clivalue_get_name() call

clivalue_name_exact_match() will already fill the buffer with
the value name.

* Fix off-by-one error in the settings generator

The generated C code wasn't allocating enough space for the '\0'
terminator for setting names

* Fix off-by-one error in the name decoder

CLIVALUE_ENCODED_NAME_MAX_BYTES represents the maximum number of
bytes in an encoded name, not the maximum word index.

* Add missing headers to PG_STATS_CONFIG group

* Make sure the settings are always up to date

* Initial attempt at encoding constants used for min/max settings

Pretty naive approach for now. Saves ~400 bytes on F1 targets.

* Move tool for generating settings to tools/

Also, rename it from settings_gen to just settings.
Delete the .gitignore in src/main/fc and just add all ignored
files in the root .gitignore, since that speeds up git.

* Only print setting stats when the env var V=1

This way we get quiet output unless the Makefile has been invoked
with verbose output.

* Make setting generation rules compatible with gmake 4

Rules were working fine on gmake 3, but failing with gmake 4. These
new rules should work with both of them.

* Fix constant value detection with GCC 7.1

GCC 6.3 emits errors with <42type-suffix> while GCC 7.1
emits the errors with only <42>

* Format uint8_t arrays a bit better

Don't add a comma after the last element

* Sort words and values determiniscally

This will help while checking the upcoming Ruby implementation
of the generator against the previous one using Go.

* Add missing headers for some groups in settings.yaml

* Replace the Go settings generator with a Ruby implementation

This makes it easier to install the required dependencies to
build INAV, since Ruby is installed by default on macOS and
installing it in Linux should be easier than installing Go
and a 3rd party package (for YAML parsing).

* Don't hardcode the value type for each parameter group

Instead, add a value_type field to each group with a default
value of MASTER_VALUE

* Simplify code for adding custom methods to StringIO

* Only resolve types for enabled fields

This fixes issues with some types which are only defined
if the feature for them is enabled (e.g. STATS or NAV).

* Implement print_stats() in the Ruby settings generator

* Rename constant in generated settings

CLIVALUE_ENCODED_NAME_USES_DIRECT_INDEXING =>
CLIVALUE_ENCODED_NAME_USES_BYTE_INDEXING

* Remove old settings generator binary from .gitignore

* Enable DEBUG while generating settings

Travis build is failing, this should help determine why

* Add $TOOLCHAINPATH to $PATH on Travis builds

* Disable DEBUG in settings.rb

Travis build is now failing because the log is too big

* Fix warning when running settings.rb on RB >= 2.4

* Don't print message when generating settings with V=0

* Use a relative path for the temporary dir

Absolute paths cause issues calling out to g++ on Windows

* Add INAV license header to settings.rb

* Add missing header to settings.c

Required since last rebase, it was compiling fine previously

* Remove unneeded extern variable decl from settings.c

Not needed anymore since we're now including settings_generated.c
directly in settings.c to simplify the Makefile.

* Use obj/tmp rather than just tmp for temporary files

* Update devdocs to mention Ruby installation

* Update Dockerfile and Vagrantfile to install Ruby

Required by the settings generator

Fixes #1997
2017-08-29 00:08:38 +10:00
..
API docs update fixes#282 2016-06-14 21:38:51 +02:00
assets Buzzer on M9 and docs update 2017-06-29 20:40:42 +02:00
development Generate CLI settings at build time (#2028) 2017-08-29 00:08:38 +10:00
Screenshots fixed docs pidadjust screenshot. 2015-03-30 12:53:56 +01:00
Wiring Updating blackbox documentation. 2015-01-06 22:32:42 +00:00
1wire.md reverted change from Cleanflight to INAV 2016-06-15 09:05:15 +02:00
Autotune - fixedwing.md fixed autotune parameters format 2017-04-23 08:34:42 +02:00
Battery.md typo in Battery.md 2017-04-26 11:10:54 +02:00
Blackbox.md Merge pull request #1738 from giacomo892/blackbox_doc_fixes 2017-07-15 10:57:57 +01:00
Board - Airbot F4 and Flip32 F4.md Docs updated 2017-07-02 20:49:51 +02:00
Board - AlienFlight.md AlienFlight F4 support 2017-05-19 23:53:39 +02:00
Board - AnyFC F7.md docs update 2017-07-19 09:57:11 +02:00
Board - BeeRotor F4.md Added BEEROTORF4 target (rebased on development, documentation added). 2017-03-28 12:33:55 +13:00
Board - CC3D.md Docs updated 2017-07-02 20:49:51 +02:00
Board - ChebuzzF3.md Translate board notes to markdown format (first cut). 2015-01-07 17:35:31 +00:00
Board - CJMCU.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Board - ColibriRace.md - Fixed Colibri Race md file PA2 duplicated 2015-10-30 01:07:33 +00:00
Board - KroozX.md Added KroozX description 2017-03-27 23:50:58 +02:00
Board - MatekF405.md update matek F405 doc 2017-07-22 21:00:40 +01:00
Board - MotoLab.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Board - Naze32.md Docs updated 2017-07-02 20:49:51 +02:00
Board - Olimexino.md Docs updated 2017-07-02 20:49:51 +02:00
Board - Omnibus F4.md Update Board - Omnibus F4.md 2017-07-28 22:25:44 +01:00
Board - Omnibus F7.md Omnibud F7 docs update 2017-07-26 20:27:30 +02:00
Board - OMNIBUS.md Docs updated 2017-07-02 20:49:51 +02:00
Board - Paris Air Hero 32 F3.md Docs update 2017-05-07 20:31:04 +10:00
Board - Paris Air Hero 32.md Update port identifier for Naze32. Add basic documentation of the Paris 2015-05-28 14:07:32 +01:00
Board - Revolution.md Docs updated 2017-07-02 20:49:51 +02:00
Board - RMDO.md Fix 1wire pass through for F3 + target config changes 2015-11-04 14:30:25 +01:00
Board - Sparky.md Docs updated 2017-07-02 20:49:51 +02:00
Board - SPRacingF3.md Docs updated 2017-07-02 20:49:51 +02:00
Board - SPRacingF3EVO.md Docs updated 2017-07-02 20:49:51 +02:00
Board - SPRacingF3EVO_1SS.md Docs updated 2017-07-02 20:49:51 +02:00
Board - YuPiF4.md Create an .md file for the YuPiF4 2016-11-04 09:42:02 +01:00
Boards.md Boards.md typos fixed 2017-04-08 02:18:31 +03:00
Buzzer.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Cli.md Docs update 2017-08-04 00:13:39 +10:00
Configuration.md replaced "cleanflight" with "inav" in documentation where it make sense 2017-04-19 17:20:15 +02:00
Controls.md removing dead links and updating StickControls.png 2017-03-14 09:36:07 -07:00
Display.md updating display image urls 2017-03-24 23:25:08 -07:00
Failsafe.md Moved RTH parameters above SET-THR 2017-05-15 11:18:32 +02:00
Getting Started.md replaced "cleanflight" with "inav" in documentation where it make sense 2017-04-19 17:20:15 +02:00
Gtune.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Inflight Adjustments.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Installation.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Introduction.md welcome to INAV? 2017-04-26 11:08:58 +02:00
LedStrip.md hardware status - doc update 2016-12-11 19:06:03 +10:00
Looptime.md typo fix 2016-11-02 18:38:44 +01:00
Mixer.md docs update 2017-07-01 15:21:36 +02:00
Navigation.md Update Navigation.md 2017-08-19 00:32:34 +08:00
Oneshot.md Correct markdown formatting on Oneshot.md. 2015-02-20 14:30:35 +00:00
override.css using css overrides to restrict wide content resizing the pdf canvas 2015-04-03 18:05:48 +02:00
PID tuning.md further clarify 'PID tuning.md' 2017-07-30 09:57:02 +01:00
Profiles.md Merge branch 'DzikuVx-inav-rates-in-dps' 2016-06-15 20:17:50 +03:00
Rssi.md Update Rssi.md 2015-05-07 07:11:09 -07:00
Rx.md IBUS updates 2017-04-26 11:24:09 +02:00
Safety.md fix capitalisation of link 2015-11-06 17:59:57 +02:00
Serial.md docs update fixes#282 2016-06-14 21:38:51 +02:00
Sonar.md overhaul - step1 2017-07-01 22:01:10 +02:00
Spektrum bind.md AlienWii32 updates 2015-05-22 11:18:35 +02:00
Telemetry.md replaced "cleanflight" with "inav" in documentation where it make sense 2017-04-19 17:20:15 +02:00
USB Flashing.md DFU: Add USB flashing docs 2015-10-09 19:28:43 +13:00