1. In a system of connected hardware elements, a method for automatically generating code to define and control the system, the method comprising: accepting a system configuration macro with sub-macros to define a hardware layout of the system of connected hardware elements, including defining system elements, subsystem elements, and connections there between; accepting a plurality of tables defining a plurality of system element behaviors, a plurality of subsystem element behaviors, and a plurality of connection options, wherein the plurality of tables include base tables that contain initial configuration values, and mode specific tables that contain mode specific configuration values; expanding a plurality of sub-macros with populated parameters; generating executable table indexing code; executing the executable table indexing code to: load the plurality of tables into corresponding subsystem element memories; modify the base tables by merging appropriate entries from the mode specific tables; access values from the modified base tables based on the populated parameters; and, program the system of connected hardware elements based on the values accessed from the modified base tables.