Guidelines for Developing a Nios II HAL Device Driver

ID 683146
Date 6/12/2015
Public
Document Table of Contents

1.12.5. Debugging with the Altera Logging Functions

The Altera logging functions are a very useful mechanism for debugging device drivers. Altera logging uses macros to bypass the HAL driver and access the peripheral directly. As a result, software can print debugging messages during the boot process before the devices are initialized.

You do not need to regenerate the .sopcinfo file in Qsys or recompile the .sof image in the Quartus II software.

Another advantage of Altera logging is that you can disable it without modifying your source code. You simply change a BSP setting and recompile, leaving zero residual impact in the compiled and linked application .elf file. All the Altera logging mechanisms are macros, and so the compiler eliminates them when they are not enabled. As a result, you can leave these calls to obtain debugging information in the source code for your released final product, with no loss of speed or code memory space. Compiling with Altera logging disabled creates a .elf file identical to a .elf compiled from source code without the Altera logging macros.

When Altera logging is enabled, the behavior of the application might be less deterministic, due to the collection and output of Altera logging messages.