diff --git a/_posts/2019-07-16-fix-bugs-and-secure-firmware-with-the-mpu.md b/_posts/2019-07-16-fix-bugs-and-secure-firmware-with-the-mpu.md index 66061670..14a3bef4 100644 --- a/_posts/2019-07-16-fix-bugs-and-secure-firmware-with-the-mpu.md +++ b/_posts/2019-07-16-fix-bugs-and-secure-firmware-with-the-mpu.md @@ -169,7 +169,7 @@ Let's override the default `MemManage` fault handler for the purposes of our exa a MemManage Fault is hit and we can investigate further. ```c -// The NRF52 fault handlers can be overriden because they are declared as weak +// The NRF52 fault handlers can be overridden because they are declared as weak // Let's override the handler and insert a breakpoint when it's hit __attribute__((naked)) void MemoryManagement_Handler(void) { diff --git a/_posts/2019-08-20-code-size-optimization-gcc-flags.md b/_posts/2019-08-20-code-size-optimization-gcc-flags.md index 1df103eb..4ad812b9 100644 --- a/_posts/2019-08-20-code-size-optimization-gcc-flags.md +++ b/_posts/2019-08-20-code-size-optimization-gcc-flags.md @@ -314,7 +314,7 @@ sys 0m3.386s So we traded 5 seconds of build time for ~3KiB of code space. > Note: /u/xenoamor on Reddit[^7] pointed out that in some cases, LTO is dropping -> vector tables even when the KEEP commmand is used. You can find more details, +> vector tables even when the KEEP command is used. You can find more details, > as well as a workaround on Launchpad[^8]. ## C Library diff --git a/_posts/2019-10-22-best-and-worst-gcc-clang-compiler-flags.md b/_posts/2019-10-22-best-and-worst-gcc-clang-compiler-flags.md index 99b573f9..4cb5a3d6 100644 --- a/_posts/2019-10-22-best-and-worst-gcc-clang-compiler-flags.md +++ b/_posts/2019-10-22-best-and-worst-gcc-clang-compiler-flags.md @@ -488,7 +488,7 @@ Then the following set of rules are applied to the promoted values: It can be hard to keep track of the set of conversions taking place but fortunately the `-Wconversion` option can be used to generate warnings when **implicit** conversions that are likely to change the underlying value take place. This warning can be tedious to eliminate from a codebase -but I've seen it help catch real bugs on numerous occassions in the past. +but I've seen it help catch real bugs on numerous occasions in the past. Consider the following simple example as an illustration: @@ -704,9 +704,9 @@ documentation[^13] states that the two permitted ABI variants for enumeration ty > of its enumerated values the type occupies a double word (long long or unsigned long long). > - The type of the storage container for an enumerated type is the smallest integer type that can contain all of its enumerated values -There a few key disadvantges of truncating enums to the shortest width type: +There a few key disadvantages of truncating enums to the shortest width type: -- Binary compatiblity can be broken if the values in an enum change between releases. For example, if the max value in +- Binary compatibility can be broken if the values in an enum change between releases. For example, if the max value in one version is 255 and then in a future version it's 4096, the size of the enum will change from a 1-byte to a 2-byte representation. This means linking against a pre-compiled library using the older version of the enum will no longer work. @@ -722,7 +722,7 @@ There a few key disadvantges of truncating enums to the shortest width type: The following is an example of how operating on a shorter width type (`uint8_t`) requires an extra masking instruction than operating on a type aligned with the architecture register size -(`int`). When an enum is trucated to a smaller width, the same type of masking instructions may be +(`int`). When an enum is truncated to a smaller width, the same type of masking instructions may be needed when operations are performed with it. ```c diff --git a/_posts/2019-10-30-cortex-m-rtos-context-switching.md b/_posts/2019-10-30-cortex-m-rtos-context-switching.md index 9102a1af..29ca0aaf 100644 --- a/_posts/2019-10-30-cortex-m-rtos-context-switching.md +++ b/_posts/2019-10-30-cortex-m-rtos-context-switching.md @@ -49,7 +49,7 @@ Mode**. The rest of the time the MCU runs in **Thread Mode**. The core can operate at either a **privileged** or **unprivileged** level. Certain instructions and operations are only allowed when the software is executing as privileged. -For example, unpriviledged code may not access NVIC registers. In Handler Mode, the core is +For example, unprivileged code may not access NVIC registers. In Handler Mode, the core is _always_ privileged. In Thread Mode, the software can execute at either level. Switching Thread Mode from the unprivileged to privileged level diff --git a/_posts/2020-03-03-gnu-make-guidelines.md b/_posts/2020-03-03-gnu-make-guidelines.md index 317a753f..4c968e58 100644 --- a/_posts/2020-03-03-gnu-make-guidelines.md +++ b/_posts/2020-03-03-gnu-make-guidelines.md @@ -119,7 +119,7 @@ $ make -l $(python -c "import multiprocessing; print(multiprocessing.cpu_count() #### Output During Parallel Invocation If you have a lot of output from the commands Make is executing in parallel, you -might see output interleaved on `stdout`. To handle this, Make has the option [`--ouput-sync`](https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html). +might see output interleaved on `stdout`. To handle this, Make has the option [`--output-sync`](https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html). I recommend using **`--output-sync=recurse`**, which will print the entire output of each target's recipe when it completes, without interspersing other @@ -407,7 +407,7 @@ test: build ``` > **NOTE!!! `.PHONY` targets are ALWAYS considered out-of-date, so Make will -ALWAYS run the recipe for those targets (and therfore any target that has a +ALWAYS run the recipe for those targets (and therefore any target that has a `.PHONY` prerequisite!). Use with caution!!** #### Implicit Rules @@ -963,7 +963,7 @@ $(BUILD_FOLDER)/%.o: %.c # The rule for building the executable "example", using OBJ_FILES as # prerequisites. Since we're not relying on an implicit rule, we need to -# explicity list CFLAGS, LDFLAGS, LDLIBS +# explicitly list CFLAGS, LDFLAGS, LDLIBS $(BUILD_FOLDER)/example: $(OBJ_FILES) @echo Linking $(notdir $@) $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@ diff --git a/_posts/2020-05-20-arm-cortexm-with-llvm-clang.md b/_posts/2020-05-20-arm-cortexm-with-llvm-clang.md index 915e2f0b..3cd66580 100644 --- a/_posts/2020-05-20-arm-cortexm-with-llvm-clang.md +++ b/_posts/2020-05-20-arm-cortexm-with-llvm-clang.md @@ -519,7 +519,7 @@ before/after others. Take a look at the official documentation for more ideas![^ Once you can compile your project with Clang, there are other compiler warnings not supported by other compilers that you can enable. These can be helpful for catching potential bugs or issues. -The exhaustive list of "Diagnostic Warnings" supported by Clang can be found in the official documentation online[^5]. However, I find it easiest to run a build with all the possible Clang warnings enabled by using `-Weverything`, disabling all errrors (`-Wno-error`) and piping the compilation output to a file I can grep after the fact. Let's try it out on the example project: +The exhaustive list of "Diagnostic Warnings" supported by Clang can be found in the official documentation online[^5]. However, I find it easiest to run a build with all the possible Clang warnings enabled by using `-Weverything`, disabling all errors (`-Wno-error`) and piping the compilation output to a file I can grep after the fact. Let's try it out on the example project: ```bash $ make clean && CLI_CFLAG_OVERRIDES="-Weverything -Wno-error" \ @@ -822,7 +822,7 @@ Disclaimers: At the time of writing this article, - Some of the official documentation, such as the instructions for "Alternative using a cmake cache" no longer work. -- It does not appear possible to compile a builtin targetting the Cortex-M hard float ABI (i.e +- It does not appear possible to compile a builtin targeting the Cortex-M hard float ABI (i.e `armv7em` target). - It does not appear possible to compile `libclang_rt` for ARM Cortex-M on OSX. You need to use Docker or be running on Linux natively. diff --git a/_posts/2020-09-08-secure-firmware-updates-with-code-signing.md b/_posts/2020-09-08-secure-firmware-updates-with-code-signing.md index db865de5..896f75f5 100644 --- a/_posts/2020-09-08-secure-firmware-updates-with-code-signing.md +++ b/_posts/2020-09-08-secure-firmware-updates-with-code-signing.md @@ -635,11 +635,11 @@ shell> The full example is available on Github at [interrupt@fwup-signing](https://github.com/memfault/interrupt/tree/master/example/fwup-signing). -> Note: While researching this post I came across Tinycrypt, an open source -> library maintained by Intel. Tinycript combines micro-ecc with additional -> primitives such as SHA-256. If I were to do it again, I would look into using -> tinycript rather than two separate libraries. - +> Note: While researching this post I came across +> [Tinycrypt](https://github.com/intel/tinycrypt), an open source library +> maintained by Intel. Tinycrypt combines micro-ecc with additional primitives +> such as SHA-256. If I were to do it again, I would look into using tinycrypt +> rather than two separate libraries. ## Additional Considerations diff --git a/_posts/2021-06-22-ubsan-trap.md b/_posts/2021-06-22-ubsan-trap.md index 09e501a0..cdc11979 100644 --- a/_posts/2021-06-22-ubsan-trap.md +++ b/_posts/2021-06-22-ubsan-trap.md @@ -145,12 +145,12 @@ We can see that the runtime was linked in: ``` If we run that program with problematic input, UBSan prints a warning, and the -printf was modifed to print a `(null)` value instead of the possibly problematic +printf was modified to print a `(null)` value instead of the possibly problematic fetch. [![img/ubsan-trap/ubsan-basic.png](/img/ubsan-trap/ubsan-basic.png)](/img/ubsan-trap/ubsan-basic.png) -If it's preferrable to have the program crash instead, use the +If it's preferable to have the program crash instead, use the `-fno-sanitize-recover=all` to disable the error recovery functionality and immediately crash (exit with non-zero exit code) on errors: diff --git a/_posts/2021-10-07-cmsis-packs.md b/_posts/2021-10-07-cmsis-packs.md index 51f17be3..fe672c20 100644 --- a/_posts/2021-10-07-cmsis-packs.md +++ b/_posts/2021-10-07-cmsis-packs.md @@ -127,8 +127,8 @@ file to flash chips) is the flash algorithm, which is specified in the top-level -The file contains many intersting pieces of information. One particularly useful -one is the Flash Algorithms used to program a peice of hardware. Look for a +The file contains many interesting pieces of information. One particularly useful +one is the Flash Algorithms used to program a piece of hardware. Look for a section of the XML with the `` tag, for example: _Note: I added the comments explaining each section_ diff --git a/_posts/2022-03-30-dealing-with-large-symbol-files.md b/_posts/2022-03-30-dealing-with-large-symbol-files.md index 25037a0c..5bd9b950 100644 --- a/_posts/2022-03-30-dealing-with-large-symbol-files.md +++ b/_posts/2022-03-30-dealing-with-large-symbol-files.md @@ -643,7 +643,7 @@ objcopy --compress-debug-sections ``` This requires no changes when using the file- debuggers and binutils are all -good about unpacking the data, and worst case it can be reveresed with +good about unpacking the data, and worst case it can be reversed with `--decompress-debug-sections`. The `dwz` tool definitely performs nice optimizations on larger binaries, but it diff --git a/_posts/2023-09-20-printf-on-embedded.md b/_posts/2023-09-20-printf-on-embedded.md index 34d67a11..54d1a9c3 100644 --- a/_posts/2023-09-20-printf-on-embedded.md +++ b/_posts/2023-09-20-printf-on-embedded.md @@ -149,7 +149,7 @@ handlers (and is probably a reasonable idea to prohibit them). Here's an approach that will cause a runtime error if a non-reentrant function is called in an interrupt context. Unfortunately it requires rebuilding newlib, -so it's really only for curiousity or the very paranoid. +so it's really only for curiosity or the very paranoid. First, rebuild newlib (or build it as part of your project build; this is probably only practical if you're using a compiler cache like ccache), setting @@ -225,7 +225,7 @@ void Foo_Interrupt_Handler(void) { } ``` -This is a pretty manual technique but it is relatively simple, and doens't +This is a pretty manual technique but it is relatively simple, and doesn't require disabling interrupts or knowing the relative preemption priority of the current call site. diff --git a/_posts/2024-01-18-ncs-github-actions.md b/_posts/2024-01-18-ncs-github-actions.md index 446d51cc..4b20ca41 100644 --- a/_posts/2024-01-18-ncs-github-actions.md +++ b/_posts/2024-01-18-ncs-github-actions.md @@ -798,7 +798,7 @@ RUN . /venv/bin/activate \ We'll build the image using this command: ```bash -# note the image tag is set to use the GitHub container registy (ghcr.io), and +# note the image tag is set to use the GitHub container registry (ghcr.io), and # we're setting the current ISO-8601 date as the tag $ DOCKER_BUILDKIT=1 docker build -f .github/Dockerfile . -t ghcr.io/noahp/memfault-nrfconnect-ci-app:$(date --iso) ```