New Horizons

Welcome to my blog

My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company

Contact

You are welcome to contact me
and ask questions or make comments
about my blog.

I have been fighting for a few days to the get the LCD driver to display "Hello World" on the LCD without success. Now it's time to setup our simulation environment and run some simulations to try to figure out what is going on. See part 23 and 24 for more information on how to setup and run a simulation. We can also take a look in EDK System Simulation Tutorial.C program

Here is the first program we are going to use. We load the code into SDK and compile and link it and then convert the load module to a memory image that we can use in our simulation.

To generate the software libraries and BSPs (Board Support Packages), right-click on the specific Software Platform project <microblaze_0_sw_platform> and select Generate Libraries and BSPs . This invokes Libgen.

The software library for the project is created in the project area: .../microblaze_0/lib/libxil.aThe address map of the system is created in the header file: .../microblaze_0/include/xparameters.h

A status message appears in the Console window at the bottom of the SDK main window.

The following libraries are generated during the libgen run:

Library

Description

Included

Size

libc.a

Standard C functions compiled for MicroBlaze

Yes

382620

libm.a

Math functions

Use -lm

414260

libxil.a

Xilinx software drivers

Yes

175302

For more information about the libraries read the document <sa_oslib_libxil_stdc.pdf > found in the directory: .../edk_install/doc/usenglish.

GNU Compiler Tools

EDK includes the GNU compiler (GCC) tools for both the PowerPC™ and MicroBlaze processors. The EDK GNU tools support both the C and C++ languages. The MicroBlaze GNU tools include mb-gcc and mb-g++ compilers, mb-as assembler and mb-ld loader/linker.

The GNU compiler is named mb-gcc for MicroBlaze and powerpc-eabi-gcc for PowerPC. The GNU compiler is a wrapper that calls the following executables:

Pre-processor (cpp0) – This is the first pass invoked by the compiler. The pre-processor replaces all macros with definitions as defined in the source and header files.

Machine and language specific compiler – This compiler works on the pre-processed code, which is the output of the first stage. The language-specific compiler is one of the following:

C Compiler (cc1) – The compiler is responsible for most of the optimizations done on the input C code and generating assembly code.

C++ Compiler (cc1plus) – The compiler is responsible for most of the optimizations done on the input C++ code and generates assembly code.

Assembler (mb-as for MicroBlaze and powerpc-eabi-as for PowerPC) – The assembly code has mnemonics in assembly language. The assembler converts these to machine language. The assembler also resolves some of the labels generated by the compiler. It creates an object file, which is passed on to the linker.

Linker (mb-ld for MicroBlaze and powerpc-eabi-ld for PowerPC) – The linker links all the object files generated by the assembler. If libraries are provided on the command line, the linker resolves some of the undefined references in the code by linking in some of the functions from the assembler.For more information read Embedded System Tools Reference Manual chapter 10.Input files

The compilers take one or more of the following files as input:

C source files

C++ source files

Assembly files

Object files

Linker scripts

If not specified, the default linker script embedded in the linker (mb-ld or powerpc-eabi-ld) is used.In addition to the files mentioned above, the compiler implicitly refers to the libraries files libc.a, libgcc.a, libm.a, and libxil.a.

Output files

The compiler generates the following files as output:

An ELF file; the default output file name is a.out

Assembly file, if -save-temps or -S option is used

Object file, if -save-temps or -c option is used

Preprocessor output, .i or .ii file, if -save-temps option is used

Output from SDK build process

When we select Project->Build Project in SDK the following process takes place.

The mb-size program displays the size of the text, data and bss parts. The total size is displayed in decimal (dec) and hexadecimal (hex) format.Text

This section of the object file contains executable program instructions. This section has thex (executable), r (read-only) and i (initialized) flags. This means that this section can beassigned to an initialized read-only memory (ROM).

Data

This section contains read-write data. This section has the w (read-write) and the i(initialized) flags. It must be mapped to initialized random access memory (RAM). Itcannot be mapped to a ROM.

BSS

This section contains un-initialized data. The program stack and the heap are also allocatedto this section. This section has the w (read-write) flag and must be mapped to RAM.