Driver Configuration and code generation

Foundation Services cannot be used as a stand-alone framework, it must be used together with either Microchip Code Configurator or Atmel START, depending on the MCU selected. Both of these configuration tools contain code generators that generates C-code based on the user's configuration. Two mechanisms are used to generate the final C-code:

Code Generation

In order to meet these requirements, MCC/Atmel START use code generation technology to generate code that exactly matches the user’s selected configuration. This results in generated code that is very similar to the code a human would write. Heavy usage of conditional compilation constructs such as #ifdef is avoided. Usage of code generation technology removes the need for layered drivers, making code smaller, faster and easier to read..

Hardware Configuration

For microcontroller projects, configuration data is normally available before or at the point of compilation. Calculation of register data and resolving of configuration can therefore be calculated at compile time. This will free up flash space and lower the processing power needed to initialize the module. An added benefit of less code in the initialization function is that time spent to get into the main loop will be shorter. A combination of constants set by MCC/Atmel START, pre-processor macros, and static functions are used to avoid doing such calculations in the runtime code.

The configuration for each module is used by the code generation technology to generate precisely the required code. The code performs configuration register writes directly just as manually written code would have done. The values written to configuration registers uses bitfield notation from the device's header files, so it is easily readable by humans.

Output from Atmel START

When exporting a project from Atmel START, the output is a single file with an *.atzip extension. This is basically an ordinary zip-file. Renaming it from *.atzip to *.zip allows it to be unzipped with standard zip-tools. This would result in a file tree as shown in the folder structure section shown elsewhere in this manual.

Reconfiguring Output from Atmel START

There may be a need to reconfigure code generated by Atmel START at a later time, for example changing baudrate of a USART, or moving an I/O pin to a new location. If using Atmel Studio 7 as IDE, the Foundation Services code can be imported back into Atmel START again and reconfigured by clicking the Re-Configure Project button at the top of the Project Explorer window (or right-clicking on the project name in Project Explorer, and selecting "Re-Configure Project"). This will open inside a window in Studio, allowing the user to perform the required changes and export the result back into the Atmel Studio 7 project. Atmel Studio 7 will detect any changed Foundation Services files, and attempt to merge them into the original project.

If using other IDEs than Atmel Studio 7, or no IDE at all, an already generated project can be reconfigured by opening the Atmel START webpage, and selecting "Load existing project" from the front page. Use the originally generated *.atzip-file as input file. The project can thereafter be reconfigured and exported anew. Any changes and conflicts between the original and the reconfigured project must be merged manually by the user.

Versioning of Foundation Services Code

Atmel START and Foundation Services are tightly connected. A specific version of Foundation Services code will only run on a compatible version of Atmel START. This may pose problems as Foundation Services generated with a particular version of Atmel START may not be possible to read back into and reconfigure with newer versions of Atmel START. Since Atmel START is a web-based tool, it may be updated without the user being able to affect the update process.

Future versions of Atmel START will add the concept of versioning, where the web-based configurator will support different versions of Foundation Services.