summaryrefslogtreecommitdiff
path: root/script/build/serprog
AgeCommit message (Collapse)Author
2024-05-06merge include/err.sh with include/option.shLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-03-27safer, simpler error handling in lbmkLeah Rowe
in shell scripts, a function named the same as a program included in the $PATH will override that program. for example, you could make a function called ls() and this would override the standand "ls". in lbmk, a part of it was first trying to run the "fail" command, deferring to "err", because some scripts call fail() which does some minor cleanup before calling err. in most cases, fail() is not defined, and it's possible that the user could have a program called "fail" in their $PATH, the behaviour of which we could not determine, and it could have disastrous effects. lbmk error handling has been re-engineered in such a way that the err function is defined in a variable, which defaults to err_ which calls err_, so defined under include/err.sh. in functions that require cleanup prior to error handling, a fail() function is still defined, and err is overridden, thus: err="fail" this change has made xx_() obsolete, so now only x_ is used. the x_ function is a wrapper that can be used to run a command and exit with non-zero status (from lbmk) if the command fails. the xx_ command did the same thing, but called fail() which would have called err(); now everything is $err example: rm -f "$filename" || err "could not delete file" this would now be: rm -f "$filename" || $err "could not delete file" overriding of err= must be done *after* including err.sh. for example: err="fail" . "include/err.sh" ^ this is wrong. instead, one must do: . "include/err.sh" err="fail" this is because err is set as a global variable under err.sh the new error handling is much cleaner, and safer. it also reduces the chance of mistakes such as: calling err when you meant to call fail. this is because the standard way is now to call $err, so you set err="fail" at the top of the script and all is well. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-27build/serprog: err if basename failsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24lbmk scripts: shorter code linesLeah Rowe
while seemingly pedantic, this does actually make code easier to read. mostly just switching to shorthand for variable names, where no expansions or patterns are used Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-22build/serprog: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16remove DEBUG handling in lbmk (not needed)Leah Rowe
all it did was set -v in the shell, which doesn't yield very useful results. this is a relic of very old design in the libreboot build system, that is no longer needed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16fix several shellcheck warningsLeah Rowe
lbmk didn't quote certain arguments in commands, or used ! -z instead of -n, things like that. simple fixes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-08lbmk: don't use status for unconditional returnsLeah Rowe
in cases where lbmk must always return from a function, there are some cases where it relies on non-zero exit status, which in practise is always the case, but may change in the future if the relevant part is modified e.g. do_something && return 0 the proper form is: do_something return 0 also do this for unconditional exits Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20consistent naming for src/pico-serprogLeah Rowe
don't ever name it rpi-pico-serprog Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20lbmk: use 2-level directory structure in script/Leah Rowe
as opposed to the current 3-level structure. recent build system simplifications have enabled this change, thus: ./build fw coreboot -> ./build roms ./build fw grub -> ./build grub ./build fw serprog -> ./build serprog ./update project release -> ./update release ./update project trees -> ./update trees ./update vendor download -> ./vendor download ./update vendor inject -> ./vendor inject alper criticised that the commands were too long, so i made them shorter! Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-16merge serprog scriptsRiku Viitanen
13 sloc reduction Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-12serprog: list available boardsRiku Viitanen
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11make libopencm3 correctlyRiku Viitanen
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-11clean up pico-serprog for releaseRiku Viitanen
moved cmake files into a separate build directory. this can just be deleted for the source release. might as well use cmake for the actual build too. that makes repeated builds faster for some reason. Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
2023-09-09Add stm32-vserprogRiku Viitanen
Tested on a Nucleo-F042K6. That has an onboard stlink: `st-flash --format ihex write bin/serprog_stm32/serprog_nucleo-f042k6.hex` The usb port used for flashing is separate, its is exposed on the pin header instead. Check boards/nucleo-f042k6.h for usb pinout. Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>