Title: The%20GreenHills%20Tool%20Chain
1The GreenHills Tool Chain
Multi 2.1/3.5 Differences Build Environment
Overview Build Through Debug Review Linking
Files ROM and RAM Execution Multi 2000
Configuration
2Multi 2.1/3.5 - Directory Structure
Multi v2.1 C\green \libsrc
\armtsf \armtsfb
Multi v3.5 C\ghs \libsys
\arm4 \arm4b
3Multi 2.1/3.5 - System Library
- System related functions
- libsys.a
- Contains customized IO stubs
- ind_io.c
- No longer replace system library in GHS directory
- /ghs/arm4b/libsys.a
- New custom GHS library
- ghs.o
- Replaced io file during final link
- na2.bld
4Multi 2.1/3.5 - Build File
- Compatible with multi2000 v3.5
- na1.bld, na2.bld, bsp.bld,
- Automatically upgraded format when modified
- Insert additional files
- Options are added or removed
- byteorder
- bigendian
- c_options
- New format not compatible with v2.1
- Using an editor to avoid format change
- Wordpad
- ultraedit
5Multi 2.1/3.5 new Compiler
- Stricter compliance to C standard
- Casting variable types
- Additional warnings generated
- No line feed
- Variable used when not initialized
- Variable not used
- NETOS files cleaned
- bsp, header files, examples
6Overview of Multi 2000 Build Environment
7Major Components
- By Green Hills Software
- Integrated Development Environment (IDE) Includes
- Builder
- Compiler
- Linker
- Editor
- Source Debugger
- Version Control
- Run-Time Error Checking
8Builder Window
- This is the main builder window
9Graphical User Interface
- Multi-2000 provides a color-assisted text editor
10Adding files to the project
- C files and libraries are added to the project
simply by a multi-selectable dialog window
11Build Through Debug Review
12Building the project
- Once all files are present in project workspace,
building is readily done
13Connecting to Target (1of 3)
- In the Builder, choose Remote gt Connect to
Target.
14Connecting to Target (2 of 3)
- Enter OCDSERV command line.
15Connecting to Target (3 of 3)
- Two new windows
- IN/OUT Displays Printfs
- TARGETcan read/write to Memory/CPU
16Starting Debugger
- In the Builder select Debug gt debug
17Debugger Features
- Set Break Points-Software and Hardware
- Step through code
- Examine C-code
- Examine Interlaced Assembly
- Examine values of variables, registers, memory
18Debugger Windows
- Interlaced Assembler displayed
- Color enhanced buttons
19Download code to Target
- Click play button or (F5)
20Run Program
- Program is Running
- Use breakpoints or step through code
21Breakpoints
- NETOS supports both software and hardware
breakpoints. - Software breakpoints (instruction fetches) are
only possible while debugging from RAM - Actual instruction is replaced with a special bit
pattern that forces the ARM into debug mode. - Unlimited number of software breakpoints
available. - Hardware breakpoints (data accesses) are possible
while debugging from RAM or ROM. - Triggered by particular address access.
- Maximum of one hardware breakpoint at a time.
(Green Hills Limitation)
22Software Breakpoints
- Adding a software breakpoint takes one click!
23Hardware Breakpoints
- Hardware breakpoints installed via entering
address or symbol name, r/w/x.
24Debugging in a multi threaded operating
environment ThreadX Tools
- Multi-2000 has a number of specific tools for
debugging and analyzing ThreadX.
25ThreadX Tools
26ThreadX Tools
27Linking Files
28Introduction
- The linker places text data into the
appropriate sections of memory, as defined by the
- User-supplied section map, or
- Default linker section map
- Application can benefit by splitting the program
into sections such that it will more readily
support different types of memories. Factors
include - Speed of parts (performance requirements)
- Cost availability
29Linker Directives File
- Major GHS supplied linker directives
.picbase Base of text sections
.text Program text
.rodata Read-only data
.rosdata Small, read-only data
.secinfo Information on section layout of the program
.data Initialized variables
.bss Zero-initialized variables
.heap Size and location of runtime heap
.stack Size and location of runtime stack
30Linker Directives File (cont.)
- NETSilicon provided linker directives
- Common linker attributes
- align(expr) - Section will start on first
expr-byte aligned address following previous
section - pad(expr) - Linker will reserve expr bytes for
this section in memory - ROM(expr) - Section becomes a ROMmable copy of
expr. Section inherits the attributes and data
of expr, while expr is modified to reserve
address space only (as if it were all padding
with no data)
.netosstack Stack for each processing mode, grows downward. Please refer to init.s
.free_mem Area of memory used by the THREADX kernel to create timer and root threads. This should not be used for any other purpose
31ROM and RAM Execution
32Basic RAM ROM requirements for NETOS
- 512KB 1MB Flash Recommended
- Primarily for code storage
- Code execution for low-end applications
- 2MB 8MB RAM Recommended
- Data buffering for DMA channels
- Thread stacks
- Heap
- Place holder for new image download
- Code execution for higher-end applications
33System Memory Map
Memory Range Memory Device Cache Option
0x00000000 - 0x00FFFFFF RAM CACHE
0x02000000 - 0x000FFFFF ROM SAFE
0x03000000 - 0x03001FFF NVRAM
0x04000000 - 0x04FFFFFF RAM DATA
0x06000000 - 0x060FFFFF ROM CACHE
0x08000000 - 0x08FFFFFF RAM INSTRUCTION
0x0A000000 - 0x0A0FFFFF ROM CACHE
0x0C000000 - 0x0CFFFFFF RAM NOT
0x0E000000 0x0E0FFFFF ROM CACHED
34System Memory Map
- BSP provided memory map is designed with cache in
mind. - Same map will work with or without cache.
- Entire memory map configured using 2 control
registers per chip select. - Address bit masking allows for multiple memory
images ideal for setting up cacheable regions.
35Relative application speed
- FLASH memory typically 90-120ns read access time.
- Can decrease access time to 35-50ns by leaving
flash chip on all the time. - SDRAM typically 7-10ns access time.
- Running from RAM is typically faster.
36Supporting FTP FLASH upgrade
- FTP server must be running out of either Flash or
RAM. - FLASH update is invoked by an FTP client
requesting to put file of special keyword
filename. - File is transferred to NetARM system memory
buffer (RAM). - A subsequent procedure, running in RAM, burns
Flash with this new image. - Running in RAM is the key to this step.
37Project Structure
Note ramimagezip.bld is main project, including
only subproject, linker. -gt Also includes
project options. -gt Inherits additional options
from a parent project.
38ramimagezip.bld - what it looks like
!build default program elxr_map_optionmap
elxr_map_optionnumeric_sort postexecgmemfile
-s ramimagezip -o ram.bin postexeccompress
ram.bin ramimagezip.bin postexecbin2obj
ramimagezip.bin .\zobjs\ramimagezip.o project.bld
subproject ramimagezip.lx linker_file
39project.bld - contents
Note the hierarchy - project.bld includes only
source files and libraries. Conclusion - the
same project.bld can be used with several
programs.
40project.bld - what it looks like
na1.lib library na2.lib library bsp.a library
tcpip.a library tx.a library appconf.h include_
file
!build default subproject root.c C bsproot.c
C dialog.c C decompress.c C reset.s assembly
cont
413 Ways to Run
ramimagezip
rom
romzip
Boot Execution
RAM
ROM
ROM
Application Execution
RAM
ROM
RAM
Note - Executable downloaded with Debugger
42Run-time Physical Memory Mapping
0xFFFF FFFF
Device Physical Address
IGNORE FOR NOW
32-bit Internal Address Space
0x001F FFFF
0x021F FFFF
CS0 (Flash)
0x0000 0000
0x0200 0000
Unmapped
0x00FF FFFF
0x00FF FFFF
CS1 (RAM)
0x0000 0000
0x0000 0000
43ramimagezip Executable Location
0xFFFF FFFF
IGNORE FOR NOW
32-bit Internal Address Space
CS0 (Flash)
Unmapped
0x00FF FFFF
CS1 (RAM)
Executable Location
0x0000 0000
44Memory Map - ramimagezip
CS1(RAM)
Top of Physical RAM
Unused
unknown until link
Initialized r/w Data
Constant Data
Text (instructions)
0x0080 0000
.picbase
Unused
stack heap bss data
Explicitly defined in linker file (ramimagezip.lx)
unknown until link
Data Section
0x0000 1000
.sdabase
Vector Table
0x0000 0000
.pidbase
45rom.bld Executable Location
IGNORE FOR NOW
32-bit Internal Address Space
0x02FF FFFF
CS0 (Flash)
0x0200 0000
Unmapped
Executable Location
0x00FF FFFF
CS1 (RAM)
0x0000 0000
46Rom-based Memory Map - rom.bld
Top of Physical Flash
Unused
CS0 (Flash)
Initialized r/w Data
Constant Data
Text (instructions)
0x0200 0000
.picbase
Top of Physical RAM
Unused
stack heap bss data
CS1 (RAM)
Data Section
.sdabase
Vector Table
0x0000 0000
.pidbase
47ROM Compression - romzip.bld
romzip is the small bootloader that will reside
at beginning of Flash, uncompressed. -gt It is
also the parent project of ramimagezip.bld.
48romzip.bld - what it looks like
!build default program c_optionnoasmwarn e
lxr_map_optionnumeric_sort arm_optionbigendian
arm_cputypearm7tm object_dir.\zobjs drive
r_opts-map entryReset_Handler_ROM sourcedirs.
\..\..\..\bsp sysincdirs.\..\..\..\..\h sysin
cdirs.\..\..\..\..\h\threadx definesNET_OS d
efinesENABLE_FLASH_COMPRESSION postexecgmemfil
e -s romzip -o romzip.bin
reset.s assembly decompress.c C .\..\loader.c C
.\zobjs\ramimagezip.o object_file bsp.a library
.\..\romzip.lx linker_file .\..\ramimagezip.bld
program romzip.map Custom
49romzip.bld Executable Location
Same as rom.bld
IGNORE FOR NOW
32-bit Internal Address Space
0x02FF FFFF
CS0 (Flash)
0x0200 0000
Unmapped
Executable Location
0x00FF FFFF
CS1 (RAM)
0x0000 0000
50Memory Map - romzip.bld
Top of Physical Flash
Unused
CS0 (Flash)
Initialized r/w Data
Constant Data
Text (instructions)
Same as rom.bld
0x0200 0000
.picbase
Top of Physical RAM
Unused
stack heap bss data
CS1 (RAM)
Data Section
.sdabase
Vector Table
0x0000 0000
.pidbase
51ramimage.o location, pre-decompression
CS0 (Flash)
Unused
- ramimage.o
- Compressed ramimage
- Linked with ramimage.lx
- Symbol name ram_buffer_0
Initialized r/w Data
Constant Data
Text (instructions)
0x0200 0000
.picbase
52Decompression and Relocation
CS1 (RAM)
CS0 (Flash)
Unused
Unused
Initialized r/w Data
decompress.c
Constant Data
Initialized r/w Data
Text (instructions)
Constant Data
RAMIMAGE_START
.picbase
Text (instructions)
Unused
0x0200 0000
stack heap bss data
RAMIMAGE_START must match .picbase as defined in
ramimagezip.lx !!! After relocation, flash is no
longer used, and execution starts at .picbase -
Final memory map same as ramimagezip !
Data Section
Vector Table
0x0000 0000
53Summary
- Develop debug with ramimagezip.bld
- Must Open romzip.bld, to inherit proper include
directories, etc. - double-click ramimagezip.bld from within
romzip.bld - Once desired functionality reached, simply
compile romzip.bld - romzip.bin will be generated
- Download to flash
- Power cycle will invoke romzip to run from Flash
- After about 15 seconds, ramimagezip will be
running - From RAM
- Flash no longer used at this point
- Original ramimagezip memory map now in effect
54Multi 2000 Configuration
55Introduction
- MULTI-2000 is a user configurable IDE
- Users can control
- Compiler options
- Linker options
- Visual look and feel
56Project Options
57General Tab
58Optimization Tab
59Run-time Error Tab
60Configuration Tab
61Action Tab
62Advanced Tab
63Project Language Options
64C Tab
65Project CPU Options
66ARM Options
67Project Toolchain Options
68Linker Tab
69Assembler Tab
70Config Options
71General Tab
72Debugger Tab
73Editor Tab
74Version Control Tab
75Colors Tab
76Summary
- For further reading consult Building and Editing
with Multi2000, Green Hills Software(M32W89NG)