Commit Graph

41 Commits

Author SHA1 Message Date
Kevin O'Connor 1717263b5a buildcommands: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:28:27 -04:00
Kevin O'Connor 947ffe706d buildcommands: Don't attach hostname and build date to version on a clean build
Most builds will be direclty from git - removing the hostname and
build date should permit reproducible binaries in that common case.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-22 11:39:25 -04:00
Kevin O'Connor 3d37362d6e buildcommands: Call irq_poll() after last task function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-04-21 19:36:49 -04:00
Kevin O'Connor 81da5379d4 buildcommands: Extend number of available mcu messages from 96 to 128
Some internal code treats the message ids as encoded "variable length
quantities", while other internal code assumes the message id is
always one byte long.  Continue using this scheme, but convert the VLQ
users to use the name "msgtag" while the 1-byte users use "msgid".
Increase the number of available msgids from 96 to 127 - the higher
values get encoded as negative "msgtags".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-18 15:21:32 -05:00
Kevin O'Connor efa497dfd8 msgproto: Avoid peeking into the msgproto class members
Update callers to only use exported methods of the msgproto objects.
This makes it easier to make internal changes to the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-02-18 14:33:44 -05:00
Kevin O'Connor 8f5c15d4dc buildcommands: Match DECL_X names to the actual C macro names
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 13:26:30 -04:00
Kevin O'Connor ff7be3e026 ctr: Encode negative integers in normal hex notation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 13:06:44 -04:00
Kevin O'Connor 7d014933ce command: Allow count parameter of DECL_ENUMERATION_RANGE() to be an expression
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 12:22:51 -04:00
Kevin O'Connor e59d875256 ctr: Encode integers in hex
Replace the custom encoding with a hex encoding.  This makes it a
little easier to inspect the CTR conversions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 11:08:51 -04:00
Kevin O'Connor 69fc1e63b4 Makefile: Translate null characters to newline characters in ctr requests
Store the CTR requests in compile_time_request.txt with the null
characters removed.  This makes it slightly easier to inspect the CTR
conversions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 10:35:26 -04:00
Kevin O'Connor 2a2cf1f536 armcm_boot: Add generic code for early board init on armcm machines
Add basic ARM Cortex-M C init code and build linker scripts to
src/generic/ code.  This can be used to simplify the various ARM board
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-08-22 09:58:58 -04:00
Kevin O'Connor 4a35f927fc initial_pins: Add ability to configure output pins at mcu startup
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 20:56:25 -04:00
Kevin O'Connor db6e2d4c9e msgproto: Convert static strings to a more generic enumeration system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 7d73a35805 command: Support evaluating C expressions in DECL_CONSTANT()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 7eda55e2b0 buildcommands: Use dictionaries to describe commands, responses, and output
Avoid transmitting lists of message ids for commands and responses -
gzip doesn't do a good job of compressing them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 72050e7352 buildcommands: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 13:15:48 -05:00
Kevin O'Connor 76f07979bb buildcommands: Make sure to not use 96 or more message ids
The mcu code assumes the encoder and parser id is always one byte.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 11:00:37 -05:00
Kevin O'Connor 150cae1d1f buildcommands: Remove unnecessary spaces from data dictionary
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 04:17:25 -05:00
Kevin O'Connor 9db0bec792 buildcommands: Detect duplicate strings when generating static string ids
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:13:31 -05:00
Kevin O'Connor b3e8429b54 buildcommands: Move data dictionary generation to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:11:00 -05:00
Kevin O'Connor 95e4c2d617 buildcommands: Move version generation to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:06:52 -05:00
Kevin O'Connor 9f420f71a5 buildcommands: Move command/response code generation to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:06:52 -05:00
Kevin O'Connor 67a5cd0409 buildcommands: Move DECL_CONSTANT code to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:06:52 -05:00
Kevin O'Connor 334507306b buildcommands: Move DECL_STATIC_STR code to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:06:52 -05:00
Kevin O'Connor 9cb98a00fc buildcommands: Move DECL_CALLLIST code to its own class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-18 03:04:18 -05:00
Kevin O'Connor 656cb2c417 build: Use git describe --always
Add --always flag to "git describe" command to get a build identifier
even if one checks out the repo with a depth parameter that prunes out
the last tagged version.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-26 21:50:05 -05:00
Kevin O'Connor d778ae1846 build: Add gcc and binutils version to mcu data dictionary
Store the gcc and binutils versions used in the compilation of the
firmware in the firmware data dictionary.  Forward that information to
the log so it is available during debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-12-21 20:32:10 -05:00
Kevin O'Connor 09140a51d5 sched: Pass shutdown reason code via longjmp() parameter
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-04 12:49:58 -04:00
Kevin O'Connor 0ac518040b msgproto: Export static_strings from mcu to host as a dictionary
Export the static strings as a dictionary instead of as a list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-07-02 14:11:10 -04:00
Kevin O'Connor c1bd628ce5 command: Directly call command_sendf() for ack/nak messages
Don't use the sendf() macro for ack and nak messages - directly call
the command_sendf() code instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-29 13:33:59 -04:00
Kevin O'Connor 1ae78d08e9 command: Encode MESSAGE_MIN in command_parser->max_size
Add the message minimum into the stored constant so it does not need
to be added at run-time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-29 13:33:58 -04:00
Kevin O'Connor d2fafbdd9e build: Request python2 for all directly executed python binaries
Some systems point python to python3 instead of python2 - explicitly
request python2 to avoid conflicts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-06-27 20:26:02 -04:00
Kevin O'Connor d4bed025ed command: Store the command parsing information directly in array
Instead of defining an array of pointers, just define the array
directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-26 13:25:51 -04:00
Kevin O'Connor a82e949c00 build: Use compile_time_request system for init, tasks, and shutdown
Avoid using linker magic to define the init, task, and shutdown
functions.  Instead, use the compile_time_request system.  This
simplifies the build and produces more efficient code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-26 12:39:34 -04:00
Kevin O'Connor b9940f0e0d build: Avoid linker magic in compile_time_request.c unique id generation
Avoid generating unique ids via memory locations and linker scripts.
Instead, generate them using code produced by buildcommands.py.
Utilize gcc's ability to perform static string comparisons at compile
time to produce a unique id for each unique string.

This fixes a build failure on ARM introduced in 142b92b8.  It also
reduces the complexity of the build.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-26 12:32:02 -04:00
Kevin O'Connor 233adfe660 build: Add __visible to variables in compile_time_request.c
Add __visible to generated code in compile_time_request.c so that the
main code can be compiled with -fwhole-program.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2017-05-15 14:02:04 -04:00
Kevin O'Connor fe95ea221b build: Define DECL_CONSTANT mechanism for defining exported constants
Add a DECL_CONSTANT macro to allow the firmware to define constants
that are to be exported to the host during the "identify" phase.  This
replaces the existing hardcoded mechanism of scanning the Kconfig
header file for certain constants.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-12-23 17:06:10 -05:00
Kevin O'Connor 33a48d926c build: Support creating and storing the data dictionary on each build
Generate the data dictionary in out/klipper.dict on each build.  This
makes it easier to use the dictionary when debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-10 20:01:52 -04:00
Kevin O'Connor 777a0b817b serialhdl: Calculate baudadjust from MCU's baud instead of host baud
Store the baud rate the MCU is configured for in the "identify" data
and use that rate when calculating the baudadjust parameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-16 21:33:35 -04:00
Kevin O'Connor 4326a3adce buildcommands: Fix max_size calculation
The maximum max_size value should not include MESSAGE_MIN - that is
already added by the runtime code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-06-05 10:52:45 -04:00
Kevin O'Connor f582a36e4d Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-05-25 11:37:40 -04:00