Newer
Older
README
^^^^^
This is the README file for the port of NuttX to the Amber Web Server from
SoC Robotics (http://www.soc-robotics.com/index.htm). The
Amber Web Server is based on an Atmel ATMega128. As of this writing,
documentation for the Amber Web Server board is available here:
http://www.soc-robotics.com/product/Amber_Specs/Amber_Processor.html
and
http://www.soc-robotics.com/pdfs/Amber%201-5a%20Hardware%20Reference%20Guide.pdf
Contents
^^^^^^^^
o Amber Web Server Features
o Pin Connections
o Atmel AVRISP mkII Connection
o Toolchains
o Windows Native Toolchains
o NuttX buildroot Toolchain
o avr-libc
o Amber Web Server Configuration Options
o Configurations
Amber Web Server Features
^^^^^^^^^^^^^^^^^^^^^^^^^
o 17.56MHz ATmega128 Atmel 8bit AVR RISC Processor
o 128Kbyte Flash
o 64Kbyte RAM
o 10BaseT Ethernet Port
o High Speed Serial Port
o 8Ch 10bit Analog Input port
o 16 Digital IO ports
o Expansion bus for daughter cards
o LED status indicators
o ISP Programming port
o 7-14VDC input
o Power via Ethernet port
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Pin Connections
^^^^^^^^^^^^^^^
-------------------- -----------------------------
ATMega128 Pinout Amber board connection
-------------------- -----------------------------
(left)
1 PEN
2 PE0 RXD0/(PDI)
3 PE1 (TXD0/PDO)
4 PE2 (XCK0/AIN0)
5 PE3 (OC3A/AIN1)
6 PE4 (OC3B/INT4)
7 PE5 (OC3C/INT5)
8 PE6 (T3/INT6)
9 PE7 (ICP3/INT7)
10 PB0 (SS)
11 PB1 (SCK)
12 PB2 (MOSI)
13 PB3 (MISO)
14 PB4 (OC0)
15 PB5 (OC1A)
16 PB6 (OC1B)
(bottom)
17 PB7 (OC2/OC1C)
18 PG3/TOSC2
19 PG4/TOSC1
20 RESET
21 VCC
22 GND
23 XTAL2
24 XTAL1
25 PD0 (SCL/INT0)
26 PD1 (SDA/INT1)
27 PD2 (RXD1/INT2)
28 PD3 (TXD1/INT3)
29 PD4 (ICP1)
30 PD5 (XCK1)
31 PD6 (T1)
32 PD7 (T2)
(left)
48 PA3 (AD3)
47 PA4 (AD4)
46 PA5 (AD5)
45 PA6 (AD6)
44 PA7 (AD7)
43 PG2(ALE)
42 PC7 (A15)
41 PC6 (A14)
40 PC5 (A13)
39 PC4 (A12)
38 PC3 (A11)
37 PC2 (A10)
36 PC1 (A9)
35 PC0 (A8)
34 PG1(RD)
33 PG0(WR)
(top)
64 AVCC
63 GND
62 AREF
61 PF0 (ADC0)
60 PF1 (ADC1)
59 PF2 (ADC2)
58 PF3 (ADC3)
57 PF4 (ADC4/TCK)
56 PF5 (ADC5/TMS)
55 PF6 (ADC6/TDO)
54 PF7 (ADC7/TDI)
53 GND
52 VCC
51 PA0 (AD0)
50 PA1 (AD1)
49 PA2 (AD2)
Atmel AVRISP mkII Connection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ISP6PIN Header
--------------
1 2
MISO o o VCC
SCK o o MOSI
RESET o o GND
(JTAG10PIN Connector)
---------------------
1 2
TCK o o GND
TDO o o VTref
TMS o o nSRST
o o (nTRST)
TDI o o GND
JTAGICE mkII Connection to 10-pin Header
------------------------------------------
10PIN Header 6PIN Header
-------------------- ---------------------
Pin 1 TCK Pin 3 SCK
Pin 2 GND Pin 6 GND
Pin 3 TDO Pin 1 MISO
Pin 4 VTref Pin 2 Vcc
Pin 6 nSRT Pin 5 Reset
Pin 9 TDI Pin 4 MOSI
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
Toolchains
^^^^^^^^^^
Buildroot:
There is a DIY buildroot version for the AVR boards here:
http://sourceforge.net/projects/nuttx/files/buildroot/. See the
following section for details on building this toolchain.
It is assumed in some places that buildroot toolchain is available
at ../misc/buildroot/build_avr. Edit the setenv.sh file if
this is not the case.
After configuring NuttX, make sure that CONFIG_AVR_BUILDROOT=y is set in your
.config file.
WinAVR:
For Cygwin development environment on Windows machines, you can use
WinAVR: http://sourceforge.net/projects/winavr/files/
It is assumed in some places that WinAVR is installed at C:/WinAVR. Edit the
setenv.sh file if this is not the case.
After configuring NuttX, make sure that CONFIG_AVR_WINAVR=y is set in your
.config file.
WARNING: There is an incompatible version of cygwin.dll in the WinAVR/bin
directory! Make sure that the path to the correct cygwin.dll file precedes
the path to the WinAVR binaries!
Linux:
For Linux, there are widely available avr-gcc packages. On Ubuntu, use:
sudo apt-get install gcc-avr gdb-avr avr-libc
After configuring NuttX, make sure that CONFIG_AVR_LINUXGCC=y is set in your
.config file.
Windows Native Toolchains
^^^^^^^^^^^^^^^^^^^^^^^^^
The WinAVR toolchain is a Windows native toolchain. There are several
limitations to using a Windows native toolchain in a Cygwin environment.
The three biggest are:
1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
performed automatically in the Cygwin makefiles using the 'cygpath'
utility but you might easily find some new path problems. If so, check
out 'cygpath -w'
2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic
links are used in Nuttx (e.g., include/arch). The make system works
around these problems for the Windows tools by copying directories
instead of linking them. But this can also cause some confusion for
you: For example, you may edit a file in a "linked" directory and find
that your changes had not effect. That is because you are building the
copy of the file in the "fake" symbolic directory. If you use a
Windows toolchain, you should get in the habit of making like this:
make clean_context all
An alias in your .bashrc file might make that less painful.
3. Dependencies are not made when using Windows versions of the GCC. This
is because the dependencies are generated using Windows pathes which do
not work with the Cygwin make.
Support has been added for making dependencies with the windows-native
toolchains. That support can be enabled by modifying your Make.defs
file as follows:
- MKDEP = $(TOPDIR)/tools/mknulldeps.sh
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
If you have problems with the dependency build (for example, if you are
not building on C:), then you may need to modify tools/mkdeps.sh
An additional issue with the WinAVR toolchain, in particular, is that it
contains an incompatible version of the Cygwin DLL in its bin/ directory.
You must take care that the correct Cygwin DLL is used.
NuttX buildroot Toolchain
^^^^^^^^^^^^^^^^^^^^^^^^^
If NuttX buildroot toolchain source tarball cne can be downloaded from the
NuttX SourceForge download site (https://sourceforge.net/projects/nuttx/files/).
This GNU toolchain builds and executes in the Linux or Cygwin environment.
1. You must have already configured Nuttx in <some-dir>/nuttx.
cd tools
./configure.sh amber/<sub-dir>
NOTE: you also must copy avr-libc header files into the NuttX include
directory with command perhaps like:
cp -a /cygdrive/c/WinAVR/include/avr include/.
2. Download the latest buildroot package into <some-dir>
3. unpack the buildroot tarball. The resulting directory may
have versioning information on it like buildroot-x.y.z. If so,
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
4. cd <some-dir>/buildroot
5. cp configs/avr-defconfig-4.5.2 .config
6. make oldconfig
7. make
8. Edit setenv.h, if necessary, so that the PATH variable includes
the path to the newly built binaries.
See the file configs/README.txt in the buildroot source tree. That has more
detailed PLUS some special instructions that you will need to follow if you
are building a toolchain for Cygwin under Windows.
avr-libc
^^^^^^^^
In any case, header files from avr-libc are required: http://www.nongnu.org/avr-libc/.
A snapshot of avr-lib is included in the WinAVR installation. For Linux
development platforms, avr-libc package is readily available (and would
be installed in the apt-get command shown above). But if you are using
the NuttX buildroot configuration on Cygwin, then you will have to build
get avr-libc from binaries.
Header File Installation
The NuttX build will required that the AVR header files be available via
the NuttX include directory. This can be accomplished by either copying
the avr-libc header files into the NuttX include directory:
cp -a <avr-libc-path>/include/avr <nuttx-path>/include/.
Or simply using a symbolic link:
ln -s <avr-libc-path>/include/avr <nuttx-path>/include/.
Build Notes:
It may not necessary to have a built version of avr-lib; only header files
are required. Bu if you choose to use the optimized libraru functions of
the flowing point library, then you may have to build avr-lib from sources.
Below are instructions for building avr-lib from fresh sources:
1. Download the avr-libc package from:
http://savannah.nongnu.org/projects/avr-libc/
I am using avr-lib-1.7.1.tar.bz2
2. Upack the tarball and cd into the
tar jxf avr-lib-1.7.1.tar.bz2
cd avr-lib-1.7.1
3. Configure avr-lib. Assuming that WinAVR is installed at the following
export PATH=/cygdrive/c/WinAVR/bin:$PATH
./configure --build=`./config.guess` --host=avr
This takes a *long* time.
4. Make avr-lib.
make
This also takes a long time because it generates variants for nearly
all AVR chips.
5. Install avr-lib.
make install
Amber Web Server Configuration Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
be set to:
CONFIG_ARCH_architecture - For use in C code:
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
chip:
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
hence, the board that supports the particular chip or SoC.
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
of delay loops
CONFIG_ENDIAN_BIG - define if big endian (default is little
endian)
CONFIG_DRAM_SIZE - Describes the installed DRAM. One of:
CONFIG_DRAM_START - The start address of installed DRAM
CONFIG_DRAM_END - Last address+1 of installed RAM
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
have LEDs
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
stack. If defined, this symbol is the size of the interrupt
stack in bytes. If not defined, the user task stacks will be
used during interrupt handling.
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
cause a 100 second delay during boot-up. This 100 second delay
serves no purpose other than it allows you to calibratre
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
the delay actually is 100 seconds.
CONFIG_AVR_INT0=n
CONFIG_AVR_INT1=n
CONFIG_AVR_INT2=n
CONFIG_AVR_INT3=n
CONFIG_AVR_INT4=n
CONFIG_AVR_INT5=n
CONFIG_AVR_INT6=n
CONFIG_AVR_INT7=n
CONFIG_AVR_TIMER0=n
CONFIG_AVR_TIMER1=n
CONFIG_AVR_TIMER2=n
CONFIG_AVR_TIMER3=n
CONFIG_AVR_SPI=n
CONFIG_AVR_USART0=y
CONFIG_AVR_USART1=n
CONFIG_AVR_ADC=n
CONFIG_AVR_ANACOMP=n
CONFIG_AVR_TWI=n
ATMEGA specific device driver settings
CONFIG_USARTn_SERIAL_CONSOLE - selects the USARTn for the
console and ttys0 (default is the USART0).
CONFIG_USARTn_RXBUFSIZE - Characters are buffered as received.
This specific the size of the receive buffer
CONFIG_USARTn_TXBUFSIZE - Characters are buffered before
being sent. This specific the size of the transmit buffer
CONFIG_USARTn_BAUD - The configure BAUD of the USART. Must be
CONFIG_USARTn_BITS - The number of bits. Must be either 7 or 8.
CONFIG_USARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
CONFIG_USARTn_2STOP - Two stop bits
Configurations
^^^^^^^^^^^^^^
Each Amber Web Server configuration is maintained in a sudirectory and can
be selected as follow:
cd tools
./configure.sh amber/<subdir>
cd -
. ./setenv.sh
NOTE: You must also copy avr-libc header files, perhaps like:
cp -a /cygdrive/c/WinAVR/include/avr include/.
Where <subdir> is one of the following:
ostest:
This configuration directory, performs a simple OS test using
apps/examples/ostest. NOTE: The OS test is quite large. In order
to get it to fit within AVR memory constraints, it will probably be
necessary to disable some OS features.