Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12612 Discussions

Nios II Macros in compliance with DO-178B Standards

Honored Contributor II


I'm new to Nios II and I want to know that macros are under Nios II in compliance with DO-178B Standards? If they don't, how can i convert these macros(like IORD, IOWR etc. in "These macros are defined in the file/components/altera_nios2/HAL/inc/io.h.") like they will be in compliance with DO-178B? For example; 

How can i implement these functions under the macros on my own in c?  


__builtin_ldwio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8))))) "originally; __builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))" 


and the others; 

__builtin_ldbio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8)))))  

__builtin_ldbuio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8))))) 

__builtin_ldhio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8)))))  

__builtin_ldhuio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8))))) 

__builtin_stwio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8)))))  

__builtin_stbio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8)))))  

__builtin_sthio (((void *)(((alt_u8*)BASE) + ((REGNUM) * (SYSTEM_BUS_WIDTH/8)))))  


I couldn't found any info about that anywhere. Please, if you can give me basic and detailed answers, i will appreciate you. Thank you.
0 Kudos
1 Reply
Honored Contributor II

Using macros is always OK. They just expand to C code that can be reviewed on its own. What is acceptable for code review depends on what the customer and certification authority demands. For safety critical applications, macros are usually not accepted unless they are processed by a qualified pre-processor. For DO-178 we used macros and did the code review of the expanded macros as shown in the pre-processor output. Of course we have the original source files available for reference. 


The __builtin_* directives expand to assembler instructions. You will need to have your code reviewers examine the object code and verify that the correct translation occurred. 


Alternatively, I've heard some company sells a tool qualification package for the GCC pre-processor. Sorry, but I don't know who makes it or even if it is still available. 

As with everything on the net, take this advice with several grains of salt.
0 Kudos