Guidelines for Developing a Nios II HAL Device Driver

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

1.2.6. Preview: Customizing the Design

This section describes typical modifications you might make to the software or hardware after you have verified that it works with hard-coded addresses.

Before carrying out these modifications, work through the steps in Debugging the bit_bang_uart Project. Design modifications are described in detail starting in The BitBangUartTransmit() Function.

After you confirm successful communication from the software to the hardware, you can change the hard-coded address to a symbolic name found in system.h. Replacing the hard-coded register address with a symbolic definition enables the Nios II SBT to update the software if the peripheral's register base address changes in the future.

UART1_BASE is a definition provided by system.h. When defining macros in system.h, the Nios II SBT takes the peripheral name as defined in Qsys, and converts it to uppercase. The Nios II SBT creates the peripheral's base address by appending _BASE to the peripheral's name.