I spent the last week working on responding to the configuration system pull request feedback and implementing the firewall. I intended to finish the UART system and integrate it into the config system, but ran into some problems with the firewall.
I initially naively implemented the firewall by appending to an array of firewall entry structs, requiring linear lookup time. Under Zach’s suggestion, I reimplemented it using bitfields to prove constant lookup time. This is important as the firewall needs to be run on every CAN message.
The issue with the config flash system preventing reprogramming the TOM without a full chip erase became a problem in debugging the firewall. I tested the config system by reading from a flash sector, incrementing the value, and writing it back throughout the entire sector. I would reset the board multiple times, and check that the incremented value was correct by using the ST-Link Utility to analyze the flash. However, between subsequent debug executions, the TrueStudio memory viewer shows incorrect information. I ultimately verified the firewall by using debug flags.
I also had a few silly bugs in the config API that manifested when implementing the firewall, involving pointer typedefs and incrementing order of operations.
Next week, I’ll finish the UART integration and XBee switching.