4.2 Software Setup
Most code examples releases contain two software configurations – free and pro. The pro configuration is setup to use the high-level optimizations of the MPLAB XC8 Compiler, which require a software license, while the free configuration is compiled with only basic optimizations. Both configurations function identically, except for code size and speed improvements from the higher-level optimizations, as shown in Table 4-1.
Software Configuration | Optimization Level | Data Memory (SRAM) Usage | Program Flash Memory Usage |
---|---|---|---|
Free | 1 | 373B | 25,240B |
Pro | S | 373B | 23,560B |
However, two additional configurations were created for this example. The gas sensor on
the Ammonia Click requires a 24-hour warmup time before reaching stable operation. The
microcontroller alone can't differentiate a brief power glitch from a long power outage,
so the 24-hour sensor warmup is enforced on start-up. However, this is unacceptable for
development, so two alternate configurations, develop
and
develop_no_cksm
, were created to accelerate start-up. These
configurations also allow the system to start with self-test failures, which is
important during development.
In develop_no_cksm
, a dummy checksum value (0x87654321) is inserted into
the firmware rather than using the Hexmate utility to add one to the output file, which
is required since the inserted checksum causes issues when compiling for debugging. The
table below shows a summary of the differences between the software configurations.
Software Configuration | Optimization Level | Hardware Debug | 24 Hour Warmup | Start-up Self-Test Failure Allowed | Valid Flash Checksum |
---|---|---|---|---|---|
free | 1 | No | Yes | No | Yes |
pro | S | No | Yes | No | Yes |
develop | 1 | No | No | Yes | Yes |
develop_no_cksm | 1 | Yes | No | Yes | No |
MPLAB X v6.20 and later default to Build for Debug on the top menu bar for the non-programming options. Pressing the program button (arrow into the microcontroller) does not build for debugging. Standalone Build (and Clean) is available in the IDE by clicking the small arrow next to the build icons.