mirror of
https://github.com/apache/nuttx.git
synced 2025-12-11 21:20:26 +08:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13f01b4cf3 | ||
|
|
d2410c93c6 | ||
|
|
f29250c671 | ||
|
|
2a929796b9 | ||
|
|
b1127822ed | ||
|
|
448c7f4618 | ||
|
|
ed4fe71b96 | ||
|
|
63f134f988 | ||
|
|
8b9fcf354e | ||
|
|
b1d5b6899a | ||
|
|
2aab4d3c3a | ||
|
|
b765d17818 | ||
|
|
54339607da | ||
|
|
0c2ff4a47c | ||
|
|
23dffb8f23 | ||
|
|
0db3f5c256 | ||
|
|
56f7399200 | ||
|
|
5f5d5496d9 | ||
|
|
3e352ca10b | ||
|
|
c5971231da | ||
|
|
b7a85058a4 | ||
|
|
4ee22e2307 | ||
|
|
daffb73624 | ||
|
|
c5af51943b | ||
|
|
795ffc3829 | ||
|
|
efa97ac0f5 | ||
|
|
b441f43a6e | ||
|
|
c9011c0f30 | ||
|
|
03771dd514 | ||
|
|
18149c3b98 | ||
|
|
aa56898b82 | ||
|
|
8e8fc062a5 | ||
|
|
c0934f429d | ||
|
|
bf9cc8b7ab | ||
|
|
47118057ea | ||
|
|
468beb1305 | ||
|
|
df2a08cf9b | ||
|
|
a02374bb45 | ||
|
|
3631d1e1ad | ||
|
|
16e8906ed5 | ||
|
|
d551204f84 | ||
|
|
3d5eebad25 | ||
|
|
b9d2a2b971 | ||
|
|
768a214d63 | ||
|
|
b282cd3f42 | ||
|
|
e689e148e8 | ||
|
|
7a1f5f61bd | ||
|
|
1e8eaa90c1 | ||
|
|
5af89ab5eb | ||
|
|
a2ed490c11 | ||
|
|
a2c26f080a | ||
|
|
30c1d1028d | ||
|
|
0baf1522b1 | ||
|
|
5325f906c7 | ||
|
|
ef4d567b78 | ||
|
|
aae8532783 | ||
|
|
1367c062f7 | ||
|
|
136e3d9fca | ||
|
|
8abec4bbb0 | ||
|
|
eaaa4adbb6 | ||
|
|
ad9565bb99 | ||
|
|
0d642851d2 | ||
|
|
e77a8b7a9a | ||
|
|
de942791be | ||
|
|
fb91e7397a | ||
|
|
b7b7b17b6b | ||
|
|
354501be05 | ||
|
|
8f85e6c028 | ||
|
|
81f2209011 | ||
|
|
28a4afaf3a | ||
|
|
30d90deedf | ||
|
|
96edde22e0 | ||
|
|
8b098e598a | ||
|
|
3f1b80218e | ||
|
|
d22b2cae65 | ||
|
|
0d8a9ffae2 | ||
|
|
2af231841b | ||
|
|
9ce040cfc6 | ||
|
|
66cabfeebb | ||
|
|
5d8f645892 | ||
|
|
62bd263bb8 |
55
ChangeLog
55
ChangeLog
@@ -57,7 +57,60 @@
|
||||
cause various problems
|
||||
* Added a test for roundrobin scheduler.
|
||||
|
||||
0.1.3 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.1 2007-03-22 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Fix error in handing signed decimal in vsprintf().
|
||||
* Major restructuring of header files to get closer to
|
||||
POSIX compliance.
|
||||
* Eliminate compilation warnings that that crept into
|
||||
recent check-ins
|
||||
* Add kill()
|
||||
* Added support for POSIX timers
|
||||
* Some Documentation updates
|
||||
* Added support for the Neuros OSD / DM320
|
||||
|
||||
0.2.2 2007-03-26 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Created the configs/ directory; separated board configuration
|
||||
from processor architecture logic
|
||||
* Add memory leak detection test to examples/ostest
|
||||
* Corrected memory leak in OS pthread join logic
|
||||
* Corrected memory leaks in examples/ostest due to failures
|
||||
to join or detach from pthreads.
|
||||
* Added pthread_once(), pthread_kill(), pthread_sigmask()
|
||||
* Added pthread_barrierattr_*() APIs
|
||||
* Added pthread_barrier_init(), pthread_barrier_destroy(), and
|
||||
pthread_barrier_wait();
|
||||
* Added pthread barrier test
|
||||
* Added protection so that errno cannot be modified from
|
||||
interrupt handling.
|
||||
* sched_setparam(), sched_setscheduler() now correctly set
|
||||
errno; pthread_setscheduler() now returns the correct errno.
|
||||
* Added pthread_setschedprio().
|
||||
* Added directories to hold board-specific header files
|
||||
* Added directories to hold board-specific drivers
|
||||
|
||||
0.2.3 2007-03-29 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* mq_receive and mq_send now return errno's appropriately
|
||||
* mq_receive and mq_send are now correctly awakened by signals.
|
||||
* Fixed an unmatched sched_lock/unlock pair in task_delete().
|
||||
* sched_lock must be called in _exit() because operation of
|
||||
task_delete() can cause pending tasks to be merged and a
|
||||
context switch to occur.
|
||||
* Added mq_timedreceive() and mq_timedsend()
|
||||
* signal mask is now inherited by both child tasks and threads.
|
||||
* Improved sharebility of stdout among pthreads (only). Nothing
|
||||
was broken, but by moving the mutual exclusion logic to a
|
||||
higher level, the printf output is more readable.
|
||||
* Fixed a bug in file system cleanup: A list was being deleted
|
||||
before the buffers contained in the list.
|
||||
* Fixed a bug in the wait-for-message-queue-not-empty logic.
|
||||
* Added a test of timed mqueue operations; detected and corrected
|
||||
some mqueue errors.
|
||||
* Identified and corrected a race condition associated with
|
||||
pthread_join. In the failure condition, memory was being
|
||||
deallocated while still in use.
|
||||
|
||||
0.2.4 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Started m68322
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||
<p>Last Updated: March 16, 2007</p>
|
||||
<p>Last Updated: March 28, 2007</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -180,7 +180,7 @@
|
||||
</table>
|
||||
|
||||
<p>
|
||||
The second release of NuttX (nuttx-0.1.2) is avalable for download
|
||||
The sixth release of NuttX (nuttx-0.2.3) is available for download
|
||||
from the <a href="http://sourceforge.net/project/showfiles.php?group_id=189573">SourceForge</a>
|
||||
website.
|
||||
</p>
|
||||
@@ -418,9 +418,63 @@ Other memory:
|
||||
cause various problems
|
||||
* Added a test for roundrobin scheduler.
|
||||
|
||||
0.1.3 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.1 2007-03-22 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Fix error in handing signed decimal in vsprintf().
|
||||
* Major restructuring of header files to get closer to
|
||||
POSIX compliance.
|
||||
* Eliminate compilation warnings that that crept into
|
||||
recent check-ins
|
||||
* Add kill()
|
||||
* Added support for POSIX timers
|
||||
* Some Documentation updates
|
||||
* Added support for the Neuros OSD / DM320
|
||||
|
||||
0.2.2 2007-03-26 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Created the configs/ directory; separated board configuration
|
||||
from processor architecture logic
|
||||
* Add memory leak detection test to examples/ostest
|
||||
* Corrected memory leak in OS pthread join logic
|
||||
* Corrected memory leaks in examples/ostest due to failures
|
||||
to join or detach from pthreads.
|
||||
* Added pthread_once(), pthread_kill(), pthread_sigmask()
|
||||
* Added pthread_barrierattr_*() APIs
|
||||
* Added pthread_barrier_init(), pthread_barrier_destroy(), and
|
||||
pthread_barrier_wait();
|
||||
* Added pthread barrier test
|
||||
* Added protection so that errno cannot be modified from
|
||||
interrupt handling.
|
||||
* sched_setparam(), sched_setscheduler() now correctly set
|
||||
errno; pthread_setscheduler() now returns the correct errno.
|
||||
* Added pthread_setschedprio().
|
||||
* Added directories to hold board-specific header files
|
||||
* Added directories to hold board-specific drivers
|
||||
|
||||
0.2.3 2007-03-29 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* mq_receive and mq_send now return errno's appropriately
|
||||
* mq_receive and mq_send are now correctly awakened by signals.
|
||||
* Fixed an unmatched sched_lock/unlock pair in task_delete().
|
||||
* sched_lock must be called in _exit() because operation of
|
||||
task_delete() can cause pending tasks to be merged and a
|
||||
context switch to occur.
|
||||
* Added mq_timedreceive() and mq_timedsend()
|
||||
* signal mask is now inherited by both child tasks and threads.
|
||||
* Improved sharebility of stdout among pthreads (only). Nothing
|
||||
was broken, but by moving the mutual exclusion logic to a
|
||||
higher level, the printf output is more readable.
|
||||
* Fixed a bug in file system cleanup: A list was being deleted
|
||||
before the buffers contained in the list.
|
||||
* Fixed a bug in the wait-for-message-queue-not-empty logic.
|
||||
* Added a test of timed mqueue operations; detected and corrected
|
||||
some mqueue errors.
|
||||
* Identified and corrected a race condition associated with
|
||||
pthread_join. In the failure condition, memory was being
|
||||
deallocated while still in use.
|
||||
|
||||
0.2.4 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Started m68322
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
62
Makefile
62
Makefile
@@ -39,6 +39,8 @@ TOPDIR = ${shell pwd}
|
||||
|
||||
ARCH_DIR = arch/$(CONFIG_ARCH)
|
||||
ARCH_SRC = $(ARCH_DIR)/src
|
||||
ARCH_INC = $(ARCH_DIR)/include
|
||||
BOARD_DIR = configs/$(CONFIG_BOARD)
|
||||
|
||||
SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE)
|
||||
|
||||
@@ -54,17 +56,46 @@ all: $(BIN)
|
||||
tools/mkconfig:
|
||||
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) mkconfig
|
||||
|
||||
include/nuttx/config.h: $(ARCH_DIR)/defconfig tools/mkconfig
|
||||
tools/mkconfig $(ARCH_DIR) > include/nuttx/config.h
|
||||
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig
|
||||
tools/mkconfig $(TOPDIR) > include/nuttx/config.h
|
||||
|
||||
include/arch: include/nuttx/config.h
|
||||
ln -sf $(TOPDIR)/$(ARCH_DIR)/include include/arch
|
||||
include/arch: Make.defs
|
||||
@if [ -e include/arch ]; then \
|
||||
if [ -h include/arch ]; then \
|
||||
rm -f include/arch ; \
|
||||
else \
|
||||
echo "include/arch exists but is not a symbolic link" ; \
|
||||
exit 1 ; \
|
||||
fi ; \
|
||||
fi
|
||||
@ln -s $(TOPDIR)/$(ARCH_DIR)/include include/arch
|
||||
|
||||
context: check_context include/nuttx/config.h include/arch
|
||||
include/arch/board: Make.defs include/arch
|
||||
@if [ -e include/arch/board ]; then \
|
||||
if [ -h include/arch/board ]; then \
|
||||
rm -f include/arch/board ; \
|
||||
else \
|
||||
echo "include/arch/board exists but is not a symbolic link" ; \
|
||||
exit 1 ; \
|
||||
fi ; \
|
||||
fi
|
||||
@ln -s $(TOPDIR)/$(BOARD_DIR)/include include/arch/board
|
||||
|
||||
$(ARCH_SRC)/board: Make.defs
|
||||
@if [ -e $(ARCH_SRC)/board ]; then \
|
||||
if [ -h $(ARCH_SRC)/board ]; then \
|
||||
rm -f $(ARCH_SRC)/board ; \
|
||||
else \
|
||||
echo "$(ARCH_SRC)/board exists but is not a symbolic link" ; \
|
||||
exit 1 ; \
|
||||
fi ; \
|
||||
fi
|
||||
@ln -s $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board
|
||||
|
||||
context: check_context include/nuttx/config.h include/arch include/arch/board $(ARCH_SRC)/board
|
||||
|
||||
clean_context:
|
||||
rm -f include/nuttx/config.h
|
||||
rm -f include/arch
|
||||
rm -f include/nuttx/config.h include/arch $(ARCH_INC)/board $(ARCH_SRC)/board
|
||||
|
||||
check_context:
|
||||
@if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \
|
||||
@@ -102,19 +133,26 @@ depend:
|
||||
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \
|
||||
done
|
||||
|
||||
clean:
|
||||
subdir_clean:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \
|
||||
fi \
|
||||
done
|
||||
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean
|
||||
$(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean
|
||||
|
||||
clean: subdir_clean
|
||||
rm -f $(BIN) $(BIN).* mm_test *.map *~
|
||||
|
||||
distclean: clean clean_context
|
||||
subdir_distclean:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \
|
||||
if [ -e $$dir/Makefile ]; then \
|
||||
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \
|
||||
fi \
|
||||
done
|
||||
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) distclean
|
||||
|
||||
distclean: clean subdir_distclean clean_context
|
||||
rm -f Make.defs setenv.sh .config
|
||||
|
||||
|
||||
|
||||
29
ReleaseNotes
29
ReleaseNotes
@@ -1,19 +1,18 @@
|
||||
Nuttx-0.1.2
|
||||
^^^^^^^^^^^
|
||||
nuttx-0.2.3
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This is the third release of NuttX. This release is primary a
|
||||
bugfix release with minimal new features. See the ChangeLog
|
||||
for a more detailed description of the changes.
|
||||
This is the sixth release of NuttX. This release is primarily
|
||||
a bugfix release. Numerous problems were fixed as detailed
|
||||
in the change log. New functionaliy includes support for
|
||||
timed messsage queues.
|
||||
|
||||
(1) Several important OS and ARM7 bugfixes,
|
||||
(2) opendir(), closedir(), readdir(), etc. added
|
||||
(3) Added C5471 watchdog timer.
|
||||
(4) Created a shareable, serial driver.
|
||||
(5) Added 'ls' command to NuttShell (nsh)
|
||||
(6) Added a test of the round robin scheduler
|
||||
See the ChangeLog for a complete list of changes.
|
||||
|
||||
This release has been verified on the Linux user-mode platform,
|
||||
the Spectrum Digital TMS320C5471 EVM using the test program under
|
||||
examples/ostest.
|
||||
This release has been verified on the Linux user-mode platform
|
||||
and the Neuros OSD using the test program under examples/ostest.
|
||||
The results of the testing is available in the source tree under
|
||||
configs/ntosd-dm320/doc/test-results. There are no known,
|
||||
critical defects but the project development status remains at
|
||||
'beta' status pending further test and evaluation.
|
||||
|
||||
This tarball contains a complete CVS snapshot from March 19, 2007.
|
||||
This tarball contains a complete CVS snapshot from March 29, 2007.
|
||||
|
||||
69
TODO
Normal file
69
TODO
Normal file
@@ -0,0 +1,69 @@
|
||||
NuttX TODO List
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
o Task/Scheduler
|
||||
- When a tasks exits, shouldn't all of its child pthreads also be terminated?
|
||||
- Should task_delete() cause atexit() function to be called?
|
||||
- Implement sys/mman.h and functions
|
||||
- Implement sys/wait.h and functions
|
||||
- Implement priority inheritance
|
||||
- Make the system timer frequency configurable via defconfig. See:
|
||||
_POSIX_CLOCKRES_MIN in limits.h
|
||||
CLK_TCK in time.h
|
||||
MSEC_PER_TICK in sched/clock_internal.h
|
||||
- Consider implementing wait, waitpid, waitid. At present, a parent has
|
||||
no information about child tasks.
|
||||
|
||||
o Memory Managment
|
||||
- Add an option to free all memory allocated by a task when the task exits.
|
||||
This is probably not be worth the overhead for a deeply embedded system.
|
||||
|
||||
o Signals
|
||||
- 'Standard' signals and signal actions are not supported.
|
||||
|
||||
o pthreads
|
||||
- pthread_cancel(): Should implemenent cancellation points and pthread_testcancel()
|
||||
|
||||
o Libraries
|
||||
|
||||
o File system
|
||||
- Add some concept like mount points to handle mounted "real" filesystems.
|
||||
|
||||
o Console Output
|
||||
|
||||
o Documentation
|
||||
- Document fs/ & driver/ logic
|
||||
- Document C-library APIs
|
||||
|
||||
o Build system
|
||||
- Names under arch are incorrect. These should hold processor architectures.
|
||||
c5471 should be arm7
|
||||
dm320 should be arm9
|
||||
pjrc-8051 should be 805x
|
||||
- SoC-specific logic should be in subdirectories under arch/<processor-name>.
|
||||
Eg. arm7/include/c5471 should hold c5471 specific header files
|
||||
- configs/pjrc-8051 should be configs/pjrc-87c52
|
||||
|
||||
o Applications & Tests
|
||||
|
||||
o C5471
|
||||
|
||||
o DM320
|
||||
|
||||
o pjrc-8052 / MCS51
|
||||
- Current status:
|
||||
- Basic OS task management seems OK
|
||||
- Fails when interrupts enabled. The stack pointer is around 0x6e
|
||||
before the failure occurs. It looks like some issue when the
|
||||
stack pointer moves from the directly to indirectly addressable
|
||||
region (0x80 boundary).
|
||||
- Work on the 8052 is temporarily on hold
|
||||
- Use timer 0 as system timer. Timer 2 is needed for second UART.
|
||||
Logic is implemented, but there needs to be a system configuration
|
||||
to change the ticks-per-second value to match the timer interrupt
|
||||
rate
|
||||
- During build, there are several integer overflows reported:
|
||||
gmtime_r.c aroud lines 184 and 185
|
||||
clock_initialize.c at line 107
|
||||
pthread_create.c at 330
|
||||
sighand.c at 225 and 244
|
||||
226
arch/README.txt
226
arch/README.txt
@@ -11,161 +11,65 @@ Table of Contents
|
||||
Architecture-Specific Code
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The file include/nuttx/arch.h identifies all of the APIs that must
|
||||
be provided by the architecture specific logic. (It also includes
|
||||
The NuttX configuration consists of:
|
||||
|
||||
o Processor architecture specific files. These are the files contained
|
||||
in the arch/<arch-name>/ directory discussed in this README.
|
||||
|
||||
o Chip/SoC specific files. Each processor processor architecture
|
||||
is embedded in chip or System-on-a-Chip (SoC) architecture. The
|
||||
full chip architecture includes the processor architecture plus
|
||||
chip-specific interrupt logic, general purpose I/O (GIO) logic, and
|
||||
specialized, internal peripherals (such as UARTs, USB, etc.).
|
||||
|
||||
These chip-specific files are contained within chip-specific
|
||||
sub-directories in the arch/<arch-name>/ directory and are selected
|
||||
via the CONFIG_ARCH_name selection
|
||||
|
||||
o Board specific files. In order to be usable, the chip must be
|
||||
contained in a board environment. The board configuration defines
|
||||
additional properties of the board including such things as
|
||||
peripheral LEDs, external peripherals (such as network, USB, etc.).
|
||||
|
||||
These board-specific configuration files can be found in the
|
||||
configs/<board-name>/ sub-directories.
|
||||
|
||||
This README will address the processor architecture specific files
|
||||
that are contained in the arch/<arch-name>/ directory. The file
|
||||
include/nuttx/arch.h identifies all of the APIs that must
|
||||
be provided by this architecture specific logic. (It also includes
|
||||
arch/<arch-name>/arch.h as described below).
|
||||
|
||||
Directory Structure
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Thie arch directory contains architecture specific logic. Each aructure
|
||||
provide a a subdirectory <arch-name>under arch/ with the folling characteristics:
|
||||
The arch directory contains architecture specific logic. The complete
|
||||
board port in is defined by the architecture-specific code in this
|
||||
directory (plus the board-specific configurations in the config/
|
||||
subdirectory). Each architecture must provide a subdirectory <arch-name>
|
||||
under arch/ with the following characteristics:
|
||||
|
||||
|
||||
<arch-name>
|
||||
|-- Make.defs
|
||||
|-- defconfig
|
||||
|-- setenv.sh
|
||||
|-- include
|
||||
<arch-name>/
|
||||
|-- include/
|
||||
| |--<chip-name>/
|
||||
| | `-- (chip-specific header files)
|
||||
| |--<other-chips>/
|
||||
| |-- arch.h
|
||||
| |-- irq.h
|
||||
| `-- types.h
|
||||
`-- src
|
||||
`-- src/
|
||||
|--<chip-name>/
|
||||
| `-- (chip-specific source files)
|
||||
|--<other-chips>/
|
||||
|-- Makefile
|
||||
`-- (architecture-specific source files)
|
||||
|
||||
Summary of Files
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
Make.defs -- This makefile fragment provides architecture and
|
||||
tool-specific build options. It will be included by all other
|
||||
makefiles in the build (once it is installed). This make fragment
|
||||
should define:
|
||||
|
||||
Tools: CC, LD, AR, NM, OBJCOPY, OBJDUMP
|
||||
Tool options: CFLAGS, LDFLAGS
|
||||
|
||||
When this makefile fragment runs, it will be passed TOPDIR which
|
||||
is the path to the root directory of the build. This makefile
|
||||
fragment may include ${TOPDIR}/.config to perform configuration
|
||||
specific settings. For example, the CFLAGS will most likely be
|
||||
different if CONFIG_DEBUG=y.
|
||||
|
||||
defconfig -- This is a configuration file similar to the Linux
|
||||
configuration file. In contains varialble/value pairs like:
|
||||
|
||||
CONFIG_VARIABLE=value
|
||||
|
||||
This configuration file will be used at build time:
|
||||
|
||||
(1) as a makefile fragment included in other makefiles, and
|
||||
(2) to generate include/nuttx/config.h which is included by
|
||||
most C files in the system.
|
||||
|
||||
The following variables are recognized by the build (you may
|
||||
also include architecture-specific settings).
|
||||
|
||||
Architecture selection:
|
||||
|
||||
CONFIG_ARCH - identifies the arch subdirectory
|
||||
CONFIG_ARCH_name - for use in C code
|
||||
|
||||
General OS setup
|
||||
|
||||
CONFIG_EXAMPLE - identifies the subdirectory in examples
|
||||
that will be used in the build
|
||||
CONFIG_DEBUG - enables built-in debug options
|
||||
CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
|
||||
time console output
|
||||
CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
regions of memory to allocate from, this specifies the
|
||||
number of memory regions that the memory manager must
|
||||
handle and enables the API mm_addregion(start, end);
|
||||
CONFIG_RR_INTERVAL - The round robin timeslice will be set
|
||||
this number of milliseconds; Round robin scheduling can
|
||||
be disabled by setting this value to zero.
|
||||
CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
|
||||
scheduler to monitor system performance
|
||||
CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a
|
||||
task name to save in the TCB. Useful if scheduler
|
||||
instrumentation is selected. Set to zero to disable.
|
||||
CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
|
||||
Used to initialize the internal time logic.
|
||||
CONFIG_JULIAN_TIME - Enables Julian time conversions
|
||||
CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
provides /dev/console. Enables stdout, stderr, stdin.
|
||||
|
||||
The following can be used to disable categories of APIs supported
|
||||
by the OS. If the compiler supports weak functions, then it
|
||||
should not be necessary to disable functions unless you want to
|
||||
restrict usage of those APIs.
|
||||
|
||||
There are certain dependency relationships in these features.
|
||||
|
||||
o mq_notify logic depends on signals to awaken tasks
|
||||
waiting for queues to become full or empty.
|
||||
o pthread_condtimedwait() depends on signals to wake
|
||||
up waiting tasks.
|
||||
|
||||
CONFIG_DISABLE_CLOCK, CONFIG_DISABLE_PTHREAD.
|
||||
CONFIG_DISABLE_SIGNALS, CONFIG_DISABLE_MQUEUE
|
||||
|
||||
|
||||
Misc libc settings
|
||||
|
||||
CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
little smaller if we do not support fieldwidthes
|
||||
|
||||
Allow for architecture optimized implementations
|
||||
|
||||
The architecture can provide optimized versions of the
|
||||
following to improve sysem performance
|
||||
|
||||
CONFIG_ARCH_MEMCPY, CONFIG_ARCH_MEMCMP, CONFIG_ARCH_MEMMOVE
|
||||
CONFIG_ARCH_MEMSET, CONFIG_ARCH_STRCMP, CONFIG_ARCH_STRCPY
|
||||
CONFIG_ARCH_STRNCPY, CONFIG_ARCH_STRLEN, CONFIG_ARCH_BZERO
|
||||
CONFIG_ARCH_KMALLOC, CONFIG_ARCH_KZMALLOC, CONFIG_ARCH_KFREE
|
||||
|
||||
Sizes of configurable things (0 disables)
|
||||
|
||||
CONFIG_MAX_TASKS - The maximum number of simultaneously
|
||||
active tasks. This value must be a power of two.
|
||||
CONFIG_NPTHREAD_KEYS - The number of items of thread-
|
||||
specific data that can be retained
|
||||
CONFIG_NFILE_DESCRIPTORS - The maximum number of file
|
||||
descriptors (one for each open)
|
||||
CONFIG_NFILE_STREAMS - The maximum number of streams that
|
||||
can be fopen'ed
|
||||
CONFIG_NAME_MAX - The maximum size of a file name.
|
||||
CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
|
||||
on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
CONFIG_NUNGET_CHARS - Number of characters that can be
|
||||
buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
|
||||
structures. The system manages a pool of preallocated
|
||||
message structures to minimize dynamic allocations
|
||||
CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
|
||||
a fixed payload size given by this settin (does not include
|
||||
other message structure overhead.
|
||||
CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
|
||||
structures. The system manages a pool of preallocated
|
||||
watchdog structures to minimize dynamic allocations
|
||||
|
||||
Stack and heap information
|
||||
|
||||
CONFIG_BOOT_FROM_FLASH - Some configurations support XIP
|
||||
operation from FLASH.
|
||||
CONFIG_STACK_POINTER - The initial stack pointer
|
||||
CONFIG_PROC_STACK_SIZE - The size of the initial stack
|
||||
CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
|
||||
CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
|
||||
CONFIG_HEAP_BASE - The beginning of the heap
|
||||
CONFIG_HEAP_SIZE - The size of the heap
|
||||
|
||||
setenv.sh -- This is a script that you can include that will be installed at
|
||||
the toplevel of the directory structure and can be sourced to set any
|
||||
necessary environment variables.
|
||||
include/<chip-name>/
|
||||
This sub-directory contains chip-specific header files.
|
||||
|
||||
include/arch.h
|
||||
This is a hook for any architecture specific definitions that may
|
||||
@@ -206,6 +110,9 @@ include/irq.h
|
||||
This file must also define NR_IRQS, the total number of IRQs supported
|
||||
by the board.
|
||||
|
||||
src/<chip-name>/
|
||||
This sub-directory contains chip-specific source files.
|
||||
|
||||
src/Makefile
|
||||
This makefile will be executed to build the targets src/libup.a and
|
||||
src/up_head.o. The up_head.o file holds the entry point into the system
|
||||
@@ -216,36 +123,29 @@ src/Makefile
|
||||
Supported Architectures
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
arch/sim
|
||||
A user-mode port of NuttX to the x86 Linux platform is available.
|
||||
The purpose of this port is primarily to support OS feature developement.
|
||||
This port does not support interrupts or a real timer (and hence no
|
||||
round robin scheduler) Otherwise, it is complete.
|
||||
|
||||
arch/c5471
|
||||
TI TMS320C5471 (also called TMS320DM180).
|
||||
TI TMS320C5471 (also called TMS320DM180 or just C5471).
|
||||
NuttX operates on the ARM7 of this dual core processor. This port
|
||||
uses the Spectrum Digital evaluation board with a GNU arm-elf toolchain*.
|
||||
This port is in progress and partially functional (However, my board
|
||||
is dead at the moment so it will be awhile before I fix it).
|
||||
complete, verified, and included in the NuttX release 0.1.1.
|
||||
|
||||
arch/dm320
|
||||
TI TMS320DM320 (also called just DM320).
|
||||
NuttX operates on the ARM9EJS of this dual core processor. This port
|
||||
complete, verified, and included in the NuttX release 0.2.1.
|
||||
|
||||
arch/m68322
|
||||
A work in progress.
|
||||
|
||||
arch/pjrc-8051
|
||||
8051 Microcontroller. This port uses the PJRC 87C52 development system
|
||||
and the SDCC toolchain. This port is not quite ready for prime time.
|
||||
|
||||
arch/sim
|
||||
x86 Linux Simulation</b>. Fully functional.
|
||||
8051 Microcontroller. This port is not quite ready for prime time.
|
||||
|
||||
Other ports for the for the TI TMS320DM270 and for MIPS are in various states
|
||||
of progress
|
||||
|
||||
Configuring NuttX
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Configuring NuttX requires only copying
|
||||
|
||||
arch/<arch-name>/Make.def to ${TOPDIR}/Make.defs
|
||||
arch/<arch-name>/setenv.sh to ${TOPDIR}/setenv.sh
|
||||
arch/<arch-name>/defconfig to ${TOPDIR}/.config
|
||||
|
||||
There is a script that automates these steps. The following steps will
|
||||
accomplish the same configuration:
|
||||
|
||||
cd tools
|
||||
./configure.sh <arch-name>
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN 0x80
|
||||
#define SCHAR_MAX 0x7f
|
||||
#define UCHAR_MAX 0xff
|
||||
|
||||
@@ -51,7 +51,7 @@ CSRCS = up_initialize.c up_initialstate.c up_idle.c up_doirq.c \
|
||||
up_exit.c up_assert.c up_blocktask.c up_unblocktask.c \
|
||||
up_releasepending.c up_reprioritizertr.c up_copystate.c \
|
||||
up_schedulesigaction.c up_sigdeliver.c up_serial.c \
|
||||
up_delay.c up_allocateheap.c up_leds.c up_watchdog.c
|
||||
up_delay.c up_allocateheap.c up_watchdog.c
|
||||
COBJS = $(CSRCS:.c=.o)
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
@@ -65,6 +65,8 @@ LINKLIBS =
|
||||
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
|
||||
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
|
||||
|
||||
LIBGCC = ${shell $(CC) -print-libgcc-file-name}
|
||||
|
||||
all: up_head.o libarch$(LIBEXT)
|
||||
@@ -81,9 +83,12 @@ libarch$(LIBEXT): $(OBJS)
|
||||
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
|
||||
done ; )
|
||||
|
||||
nuttx: $(LINKOBJS)
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
--start-group $(LDLIBS) --end-group $(EXTRA_LIBS) $(LIBGCC)
|
||||
board/libboard$(LIBEXT):
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) libboard$(LIBEXT)
|
||||
|
||||
nuttx: $(LINKOBJS) board/libboard$(LIBEXT)
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
@@ -101,14 +106,21 @@ endif
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) depend
|
||||
touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) clean ; \
|
||||
fi
|
||||
rm -f libarch$(LIBEXT) *.o *~
|
||||
|
||||
distclean: clean
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) distclean ; \
|
||||
fi
|
||||
rm -f Make.dep .depend
|
||||
|
||||
-include Make.dep
|
||||
|
||||
@@ -40,10 +40,18 @@
|
||||
* Included Files
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BOARD_C5471EVM)
|
||||
# include <arch/board/c5471evm.h>
|
||||
#else
|
||||
# warning "Undefined C5471 Board"
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
@@ -72,10 +80,6 @@
|
||||
#define CC_Z_BIT (1 << 30)
|
||||
#define CC_N_BIT (1 << 31)
|
||||
|
||||
/* Clocking *************************************************/
|
||||
|
||||
#define C5471_CLOCK 47500000 /* 47.5 MHz */
|
||||
|
||||
/* UARTs ****************************************************/
|
||||
|
||||
#define UART_IRDA_BASE 0xffff0800
|
||||
@@ -157,30 +161,30 @@
|
||||
/* Bits 31-7: Reserved */
|
||||
#define UART_LCR_BOC 0x00000040 /* Bit 6: Break Control */
|
||||
/* Bit 5: Parity Type 2 */
|
||||
#define UART_LCR_ParEven 0x00000010 /* Bit 4: Parity Type 1 */
|
||||
#define UART_LCR_ParOdd 0x00000000
|
||||
#define UART_LCR_ParEn 0x00000008 /* Bit 3: Paity Enable */
|
||||
#define UART_LCR_ParDis 0x00000000
|
||||
#define UART_LCR_2stop 0x00000004 /* Bit 2: Number of stop bits */
|
||||
#define UART_LCR_1stop 0x00000000
|
||||
#define UART_LCR_5bits 0x00000000 /* Bits 0-1: Word-length */
|
||||
#define UART_LCR_6bits 0x00000001
|
||||
#define UART_LCR_7bits 0x00000002
|
||||
#define UART_LCR_8bits 0x00000003
|
||||
#define UART_LCR_PAREVEN 0x00000010 /* Bit 4: Parity Type 1 */
|
||||
#define UART_LCR_PARODD 0x00000000
|
||||
#define UART_LCR_PAREN 0x00000008 /* Bit 3: Paity Enable */
|
||||
#define UART_LCR_PARDIS 0x00000000
|
||||
#define UART_LCR_2STOP 0x00000004 /* Bit 2: Number of stop bits */
|
||||
#define UART_LCR_1STOP 0x00000000
|
||||
#define UART_LCR_5BITS 0x00000000 /* Bits 0-1: Word-length */
|
||||
#define UART_LCR_6BITS 0x00000001
|
||||
#define UART_LCR_7BITS 0x00000002
|
||||
#define UART_LCR_8BITS 0x00000003
|
||||
|
||||
#define UART_FCR_FTL 0x00000000
|
||||
#define UART_FCR_FIFO_EN 0x00000001
|
||||
#define UART_FCR_TX_CLR 0x00000002
|
||||
#define UART_FCR_RX_CLR 0x00000004
|
||||
|
||||
#define UART_IER_RecvInt 0x00000001
|
||||
#define UART_IER_XmitInt 0x00000002
|
||||
#define UART_IER_LineStsInt 0x00000004
|
||||
#define UART_IER_ModemStsInt 0x00000008 /* IrDA UART only */
|
||||
#define UART_IER_XoffInt 0x00000020
|
||||
#define UART_IER_RtsInt 0x00000040 /* IrDA UART only */
|
||||
#define UART_IER_CtsInt 0x00000080 /* IrDA UART only */
|
||||
#define UART_IER_AllInts 0x000000ff
|
||||
#define UART_IER_RECVINT 0x00000001
|
||||
#define UART_IER_XMITINT 0x00000002
|
||||
#define UART_IER_LINESTSINT 0x00000004
|
||||
#define UART_IER_MODEMSTSINT 0x00000008 /* IrDA UART only */
|
||||
#define UART_IER_XOFFINT 0x00000020
|
||||
#define UART_IER_RTSINT 0x00000040 /* IrDA UART only */
|
||||
#define UART_IER_CTSINT 0x00000080 /* IrDA UART only */
|
||||
#define UART_IER_INTMASK 0x000000ff
|
||||
|
||||
#define BAUD_115200 0x00000001
|
||||
#define BAUD_57600 0x00000002
|
||||
@@ -370,11 +374,6 @@ static inline void putreg16(uint16 val, unsigned int addr)
|
||||
__asm__ __volatile__("\tstrh %0, [%1]\n\t": : "r"(val), "r"(addr));
|
||||
}
|
||||
|
||||
/* Most C5471 registers are 16-bits wide */
|
||||
|
||||
#define getreg(a) getreg16(1)
|
||||
#define putreg(v,a) putreg16(v,a)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __C5471_H */
|
||||
|
||||
@@ -79,7 +79,7 @@ static inline uint32 up_getsp(void)
|
||||
* Name: up_stackdump
|
||||
************************************************************/
|
||||
|
||||
#ifdef CONFIG_C5471_STACKDUMP
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
static void up_stackdump(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
@@ -89,7 +89,7 @@ static void up_stackdump(void)
|
||||
|
||||
if (rtcb->pid == 0)
|
||||
{
|
||||
stack_base = g_heapbase - CONFIG_PROC_STACK_SIZE;
|
||||
stack_base = g_heapbase - 4;
|
||||
stack_size = CONFIG_PROC_STACK_SIZE;
|
||||
}
|
||||
else
|
||||
@@ -137,7 +137,7 @@ static void _up_assert(int errorcode) /* __attribute__ ((noreturn)) */
|
||||
(void)irqsave();
|
||||
for(;;)
|
||||
{
|
||||
#ifdef CONFIG_C5471_LEDS
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
up_ledon(LED_PANIC);
|
||||
up_delay(250);
|
||||
up_ledoff(LED_PANIC);
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* processor, etc. This value is retained only for debug
|
||||
* purposes.
|
||||
* stack_alloc_ptr: Pointer to allocated stack
|
||||
* adj_stack_ptr: Adjusted StatckAllocPtr for HW. The
|
||||
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
|
||||
* initial value of the stack pointer.
|
||||
*
|
||||
* Inputs:
|
||||
|
||||
@@ -97,7 +97,6 @@ void up_doirq(int irq, uint32* regs)
|
||||
* disabled.
|
||||
*/
|
||||
|
||||
current_regs = NULL;
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
up_ledoff(LED_INIRQ);
|
||||
|
||||
@@ -145,6 +145,13 @@ void _exit(int status)
|
||||
|
||||
(void)sched_removereadytorun(tcb);
|
||||
|
||||
/* We are not in a bad stack-- the head of the ready to run task list
|
||||
* does not correspond to the thread that is running. Disabling pre-
|
||||
* emption on this TCB should be enough to keep things stable.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
|
||||
/* Move the TCB to the specified blocked task list and delete it */
|
||||
|
||||
sched_addblocked(tcb, TSTATE_TASK_INACTIVE);
|
||||
@@ -159,6 +166,10 @@ void _exit(int status)
|
||||
(void)sched_mergepending();
|
||||
}
|
||||
|
||||
/* Now calling sched_unlock() should have no effect */
|
||||
|
||||
sched_unlock();
|
||||
|
||||
/* Now, perform the context switch to the new ready-to-run task at the
|
||||
* head of the list.
|
||||
*/
|
||||
|
||||
@@ -117,7 +117,7 @@ __start:
|
||||
#endif
|
||||
/* Initialize onboard LEDs */
|
||||
|
||||
#ifdef CONFIG_C5471_LEDS
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
bl up_ledinit
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
* Included Files
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#if defined(CONFIG_BOARD_C5471EVM)
|
||||
# include <arch/board/c5471evm.h>
|
||||
#else
|
||||
# warning "Undefined C5471 Board"
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
@@ -53,18 +61,7 @@
|
||||
#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
|
||||
#undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */
|
||||
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
||||
#undef CONFIG_DUMP_ON_EXIT /* Dumpt task state on exit */
|
||||
|
||||
/* LED definitions */
|
||||
|
||||
#define LED_STARTED 0
|
||||
#define LED_HEAPALLOCATE 1
|
||||
#define LED_IRQSENABLED 2
|
||||
#define LED_STACKCREATED 3
|
||||
#define LED_INIRQ 4
|
||||
#define LED_SIGNAL 5
|
||||
#define LED_ASSERTION 6
|
||||
#define LED_PANIC 7
|
||||
#undef CONFIG_DUMP_ON_EXIT /* Dump task state on exit */
|
||||
|
||||
/************************************************************
|
||||
* Public Types
|
||||
@@ -156,7 +153,7 @@ extern void up_maskack_irq(int irq);
|
||||
|
||||
/* Defined in up_leds.c */
|
||||
|
||||
#ifdef CONFIG_C5471_LEDS
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
extern void up_ledinit(void);
|
||||
extern void up_ledon(int led);
|
||||
extern void up_ledoff(int led);
|
||||
|
||||
@@ -247,9 +247,9 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint16 *ier)
|
||||
{
|
||||
if (ier)
|
||||
{
|
||||
*ier = priv->regs.ier & UART_IER_AllInts;
|
||||
*ier = priv->regs.ier & UART_IER_INTMASK;
|
||||
}
|
||||
priv->regs.ier &= ~UART_IER_AllInts;
|
||||
priv->regs.ier &= ~UART_IER_INTMASK;
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint16 *ier)
|
||||
|
||||
static inline void up_restoreuartint(struct up_dev_s *priv, uint16 ier)
|
||||
{
|
||||
priv->regs.ier |= ier & (UART_IER_RecvInt|UART_IER_XmitInt);
|
||||
priv->regs.ier |= ier & (UART_IER_RECVINT|UART_IER_XMITINT);
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
}
|
||||
|
||||
@@ -357,25 +357,25 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
|
||||
if (priv->bits == 7)
|
||||
{
|
||||
cval = UART_LCR_7bits;
|
||||
cval = UART_LCR_7BITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
cval = UART_LCR_8bits;
|
||||
cval = UART_LCR_8BITS;
|
||||
}
|
||||
|
||||
if (priv->stopbits2)
|
||||
{
|
||||
cval |= UART_LCR_2stop;
|
||||
cval |= UART_LCR_2STOP;
|
||||
}
|
||||
|
||||
if (priv->parity == 1) /* Odd parity */
|
||||
{
|
||||
cval |= (UART_LCR_ParEn|UART_LCR_ParOdd);
|
||||
cval |= (UART_LCR_PAREN|UART_LCR_PARODD);
|
||||
}
|
||||
else if (priv->parity == 2) /* Even parity */
|
||||
{
|
||||
cval |= (UART_LCR_ParEn|UART_LCR_ParEven);
|
||||
cval |= (UART_LCR_PAREN|UART_LCR_PAREVEN);
|
||||
}
|
||||
|
||||
/* Both the IrDA and MODEM UARTs support RESET and UART mode. */
|
||||
@@ -645,13 +645,13 @@ static void up_rxint(struct uart_dev_s *dev, boolean enable)
|
||||
if (enable)
|
||||
{
|
||||
#ifndef CONFIG_SUPPRESS_SERIAL_INTS
|
||||
priv->regs.ier |= UART_IER_RecvInt;
|
||||
priv->regs.ier |= UART_IER_RECVINT;
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->regs.ier &= ~UART_IER_RecvInt;
|
||||
priv->regs.ier &= ~UART_IER_RECVINT;
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
}
|
||||
}
|
||||
@@ -698,13 +698,13 @@ static void up_txint(struct uart_dev_s *dev, boolean enable)
|
||||
if (enable)
|
||||
{
|
||||
#ifndef CONFIG_SUPPRESS_SERIAL_INTS
|
||||
priv->regs.ier |= UART_IER_XmitInt;
|
||||
priv->regs.ier |= UART_IER_XMITINT;
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->regs.ier &= ~UART_IER_XmitInt;
|
||||
priv->regs.ier &= ~UART_IER_XMITINT;
|
||||
up_serialout(priv, UART_IER_OFFS, priv->regs.ier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* processor, etc. This value is retained only for debug
|
||||
* purposes.
|
||||
* stack_alloc_ptr: Pointer to allocated stack
|
||||
* adj_stack_ptr: Adjusted StatckAllocPtr for HW. The
|
||||
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
|
||||
* initial value of the stack pointer.
|
||||
*
|
||||
* Inputs:
|
||||
|
||||
@@ -152,9 +152,7 @@ up_vectorirq:
|
||||
* no pending interrupt */
|
||||
.Lhaveirq:
|
||||
#endif
|
||||
/* Then call the IRQ handler with interrupt disabled.
|
||||
* rq_dispatch(int irq, struct xcptcontext *xcp)
|
||||
*/
|
||||
/* Then call the IRQ handler with interrupt disabled. */
|
||||
|
||||
mov fp, #0 /* Init frame pointer */
|
||||
mov r1, sp /* Get r1=xcp */
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN 0x80
|
||||
#define SCHAR_MAX 0x7f
|
||||
#define UCHAR_MAX 0xff
|
||||
|
||||
@@ -39,10 +39,7 @@ MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS = up_vectors.S up_saveusercontext.S up_fullcontextrestore.S \
|
||||
up_restart.S up_cache.S
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
ASRCS += up_lowputc.S
|
||||
endif
|
||||
up_restart.S up_cache.S up_lowputc.S
|
||||
AOBJS = $(ASRCS:.S=.o)
|
||||
|
||||
CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_boot.c \
|
||||
@@ -66,6 +63,8 @@ LINKLIBS =
|
||||
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
|
||||
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
|
||||
|
||||
LIBGCC = ${shell $(CC) -print-libgcc-file-name}
|
||||
|
||||
all: up_head.o libarch$(LIBEXT)
|
||||
@@ -82,9 +81,12 @@ libarch$(LIBEXT): $(OBJS)
|
||||
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
|
||||
done ; )
|
||||
|
||||
nuttx: $(LINKOBJS)
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
--start-group $(LDLIBS) --end-group $(EXTRA_LIBS) $(LIBGCC)
|
||||
board/libboard$(LIBEXT):
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) libboard$(LIBEXT)
|
||||
|
||||
nuttx: $(LINKOBJS) board/libboard$(LIBEXT)
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
--start-group $(LDLIBS) -lboard --end-group $(EXTRA_LIBS) $(LIBGCC)
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
@@ -101,15 +103,24 @@ ifeq ($(CONFIG_RRLOAD_BINARY),y)
|
||||
endif
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) depend ; \
|
||||
if
|
||||
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) clean ; \
|
||||
fi
|
||||
rm -f libarch$(LIBEXT) *.o *~
|
||||
|
||||
distclean: clean
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) distclean ; \
|
||||
fi
|
||||
rm -f Make.dep .depend
|
||||
|
||||
-include Make.dep
|
||||
|
||||
175
arch/dm320/src/dm320-gio.h
Normal file
175
arch/dm320/src/dm320-gio.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/************************************************************************************
|
||||
* dm320-gio.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __DM320_GIO_H
|
||||
#define __DM320_GIO_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* General I/O Registers */
|
||||
|
||||
#define DM320_GIO_DIR0 (DM320_PERIPHERALS_VADDR + 0x0580) /* GIO Direction Register 0 */
|
||||
#define DM320_GIO_DIR1 (DM320_PERIPHERALS_VADDR + 0x0582) /* GIO Direction Register 1 */
|
||||
#define DM320_GIO_DIR2 (DM320_PERIPHERALS_VADDR + 0x0584) /* GIO Direction Register 2 */
|
||||
#define DM320_GIO_INV0 (DM320_PERIPHERALS_VADDR + 0x0586) /* GIO Inversion Register 0 */
|
||||
#define DM320_GIO_INV1 (DM320_PERIPHERALS_VADDR + 0x0588) /* GIO Inversion Register 1 */
|
||||
#define DM320_GIO_INV2 (DM320_PERIPHERALS_VADDR + 0x058A) /* GIO Inversion Register 2 */
|
||||
#define DM320_GIO_BITSET0 (DM320_PERIPHERALS_VADDR + 0x058C) /* GIO Bit Set Register 0 */
|
||||
#define DM320_GIO_BITSET1 (DM320_PERIPHERALS_VADDR + 0x058E) /* GIO Bit Set Register 1 */
|
||||
#define DM320_GIO_BITSET2 (DM320_PERIPHERALS_VADDR + 0x0590) /* GIO Bit Set Register 2 */
|
||||
#define DM320_GIO_BITCLR0 (DM320_PERIPHERALS_VADDR + 0x0592) /* GIO Bit Clear Register 0 */
|
||||
#define DM320_GIO_BITCLR1 (DM320_PERIPHERALS_VADDR + 0x0594) /* GIO Bit Clear Register 1 */
|
||||
#define DM320_GIO_BITCLR2 (DM320_PERIPHERALS_VADDR + 0x0596) /* GIO Bit Clear Register 2 */
|
||||
#define DM320_GIO_IRQPORT (DM320_PERIPHERALS_VADDR + 0x0598) /* GIO IRQ Port Setting Register */
|
||||
#define DM320_GIO_IRQEDGE (DM320_PERIPHERALS_VADDR + 0x059A) /* GIO IRQ Edge Setting Register */
|
||||
#define DM320_GIO_CHAT0 (DM320_PERIPHERALS_VADDR + 0x059C) /* GIO Chatter Setting Register 0 */
|
||||
#define DM320_GIO_CHAT1 (DM320_PERIPHERALS_VADDR + 0x059E) /* GIO Chatter Setting Register 1 */
|
||||
#define DM320_GIO_CHAT2 (DM320_PERIPHERALS_VADDR + 0x05A0) /* GIO Chatter Setting Register 2 */
|
||||
#define DM320_GIO_NCHAT (DM320_PERIPHERALS_VADDR + 0x05A2) /* GIO Chatter Value Register */
|
||||
#define DM320_GIO_FSEL0 (DM320_PERIPHERALS_VADDR + 0x05A4) /* GIO Function Select Register 0 */
|
||||
#define DM320_GIO_FSEL1 (DM320_PERIPHERALS_VADDR + 0x05A6) /* GIO Function Select Register 1 */
|
||||
#define DM320_GIO_FSEL2 (DM320_PERIPHERALS_VADDR + 0x05A8) /* GIO Function Select Register 2 */
|
||||
#define DM320_GIO_FSEL3 (DM320_PERIPHERALS_VADDR + 0x05AA) /* GIO Function Select Register 3 */
|
||||
|
||||
/* Macros for GIO access */
|
||||
|
||||
#define _GIO_READ_REG(pin, reg0, reg1, reg2, bval) \
|
||||
do { \
|
||||
register uint32 _reg; register int _pin; \
|
||||
if ((pin) < 16) { _reg = (reg0); _pin = (pin); } \
|
||||
else if ((pin) < 32) { _reg = (reg1); _pin = ((pin) - 16); } \
|
||||
else { _reg = (reg2); _pin = ((pin) - 32); } \
|
||||
bval = ((getreg16(_reg) & (1<<_pin)) != 0); \
|
||||
}
|
||||
|
||||
#define _GIO_SET_REG(pin, reg0, reg1, reg2) \
|
||||
do { \
|
||||
register uint32 _reg; register int _pin; \
|
||||
if ((pin) < 16) { _reg = (reg0); _pin = (pin); } \
|
||||
else if ((pin) < 32) { _reg = (reg1); _pin = ((pin) - 16); } \
|
||||
else { _reg = (reg2); _pin = ((pin) - 32); } \
|
||||
putreg16((getreg16(_reg) | (1 << _pin)), _reg)); \
|
||||
} while (0)
|
||||
|
||||
#define _GIO_CLEAR_REG(pin, reg0, reg1, reg2) \
|
||||
do { \
|
||||
register uint32 _reg; register int _pin; \
|
||||
if ((pin) < 16) { _reg = (reg0); _pin = (pin); } \
|
||||
else if ((pin) < 32) { _reg = (reg1); _pin = ((pin) - 16); } \
|
||||
else { _reg = (reg2); _pin = ((pin) - 32); } \
|
||||
putreg16((getreg16(_reg) & ~(1 << _pin)), _reg)); \
|
||||
} while (0)
|
||||
|
||||
/* Select GIO input or output */
|
||||
|
||||
#define GIO_INPUT(pin) \
|
||||
_GIO_SET_REG((pin), DM320_GIO_DIR0, DM320_GIO_DIR1, DM320_GIO_DIR2)
|
||||
#define GIO_OUTPUT(pin) \
|
||||
_GIO_CLEAR_REG((pin), DM320_GIO_DIR0, DM320_GIO_DIR1, DM320_GIO_DIR2)
|
||||
|
||||
/* Select inverted or non-inverted GIO */
|
||||
|
||||
#define GIO_INVERTED(pin) \
|
||||
_GIO_SET_REG((pin), DM320_GIO_INV0, DM320_GIO_INV1, DM320_GIO_INV2)
|
||||
#define GIO_NONINVERTED(pin) \
|
||||
_GIO_CLEAR_REG((pin), DM320_GIO_INV0, DM320_GIO_INV1, DM320_GIO_INV2)
|
||||
|
||||
/* Set and clear outputs */
|
||||
|
||||
#define GIO_SET_OUTPUT(pin) \
|
||||
_GIO_SET_REG((pin), DM320_GIO_BITSET0, DM320_GIO_BITSET1, DM320_GIO_BITSET2)
|
||||
#define GIO_CLEAR_OUTPUT(pin) \
|
||||
_GIO_SET_REG((pin), DM320_GIO_BITCLR0, DM320_GIO_BITCLR1, DM320_GIO_BITCLR2)
|
||||
|
||||
/* Read input */
|
||||
|
||||
#define GIO_READ_INPUT(pin, bval) \
|
||||
_GIO_READ_REG((pin), DM320_GIO_BITSET0, DM320_GIO_BITSET1, DM320_GIO_BITSET2, (bval))
|
||||
|
||||
/* Configure GIO pins */
|
||||
|
||||
#define _GIO_SET_CONFIG(reg, sh, val) \
|
||||
putreg16(((getreg16(reg) & ~(3 << sh)) | (val << sh)), (reg))
|
||||
|
||||
#define GIO_CONFIGURE(pin, val) \
|
||||
do {\
|
||||
if ((pin) < 10) _GIO_SET_CONFIG(DM320_GIO_FSEL0, 0, (val)); \
|
||||
else if ((pin) < 17) _GIO_SET_CONFIG(DM320_GIO_FSEL0, 2*((pin)-9), (val)); \
|
||||
else if ((pin) < 25) _GIO_SET_CONFIG(DM320_GIO_FSEL1, 2*((pin)-17), (val)); \
|
||||
else if ((pin) < 33) _GIO_SET_CONFIG(DM320_GIO_FSEL2, 2*((pin)-25), (val)); \
|
||||
else _GIO_SET_CONFIG(DM320_GIO_FSEL3, 2*((pin)-33), (val)); \
|
||||
}
|
||||
|
||||
/* Configure GIO interrupts (pins 1-15) */
|
||||
|
||||
#define GIO_INTERRUPT(pin) \
|
||||
if (pin < 16) putreg16((getreg16(DM320_GIO_IRQPORT) | (1<<(pin))), DM320_GIO_IRQPORT)
|
||||
#define GIO_NONINTERRUPT(pin) \
|
||||
if (pin < 16) putreg16((getreg16(DM320_GIO_IRQPORT) & ~(1<<(pin))), DM320_GIO_IRQPORT)
|
||||
#define GIO_FALLINGEDGE(pin) \
|
||||
if (pin < 16) { \
|
||||
putreg16((getreg16(DM320_GIO_IRQEDGE) & ~(1<<(pin))), DM320_GIO_IRQEDGE) \
|
||||
putreg16((getreg16(DM320_GIO_INV0) & ~(1<<(pin))), DM320_GIO_INV0); \
|
||||
}
|
||||
#define GIO_RISINGEDGE(pin) \
|
||||
if (pin < 16) { \
|
||||
putreg16((getreg16(DM320_GIO_IRQEDGE) & ~(1<<(pin))), DM320_GIO_IRQEDGE); \
|
||||
putreg16((getreg16(DM320_GIO_INV0) | (1<<(pin))), DM320_GIO_INV0); \
|
||||
}
|
||||
#define GIO_BOTHEDGES(pin) \
|
||||
if (pin < 16) { \
|
||||
putreg16((getreg16(DM320_GIO_IRQEDGE) | (1<<(pin))), DM320_GIO_IRQEDGE); \
|
||||
putreg16((getreg16(DM320_GIO_INV0) & ~(1<<(pin))), DM320_GIO_INV0); \
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Inline Functions
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __DM320_GIO_H */
|
||||
@@ -40,16 +40,24 @@
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "arm9.h"
|
||||
#include "ntosd.h"
|
||||
|
||||
#if defined(CONFIG_BOARD_NTOSD_DM320)
|
||||
# include <arch/board/ntosd.h>
|
||||
#else
|
||||
# warning "Unknown DM320 board"
|
||||
#endif
|
||||
|
||||
#include "dm320-memorymap.h"
|
||||
#include "dm320-uart.h"
|
||||
#include "dm320-timer.h"
|
||||
#include "dm320-intc.h"
|
||||
#include "dm320-gio.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include "dm320.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
@@ -73,5 +74,5 @@
|
||||
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
{
|
||||
*heap_start = (FAR void*)g_heapbase;
|
||||
*heap_size = (CONFIG_DRAM_START + CONFIG_DRAM_SIZE) - g_heapbase;
|
||||
*heap_size = (DM320_SDRAM_VADDR + CONFIG_DRAM_SIZE) - g_heapbase;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,15 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
* debug is not selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
@@ -83,14 +92,26 @@ static inline uint32 up_getsp(void)
|
||||
static void up_stackdump(void)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 stack_base = (uint32)rtcb->adj_stack_ptr;
|
||||
uint32 sp = up_getsp();
|
||||
uint32 stack_base;
|
||||
uint32 stack_size;
|
||||
|
||||
if (rtcb->pid == 0)
|
||||
{
|
||||
stack_base = g_heapbase - 4;
|
||||
stack_size = CONFIG_PROC_STACK_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
stack_base = (uint32)rtcb->adj_stack_ptr;
|
||||
stack_size = (uint32)rtcb->adj_stack_size;
|
||||
}
|
||||
|
||||
lldbg("stack_base: %08x\n", stack_base);
|
||||
lldbg("stack_size: %08x\n", rtcb->adj_stack_size);
|
||||
lldbg("stack_size: %08x\n", stack_size);
|
||||
lldbg("sp: %08x\n", sp);
|
||||
|
||||
if (sp >= stack_base || sp < stack_base - rtcb->adj_stack_size)
|
||||
if (sp >= stack_base || sp < stack_base - stack_size)
|
||||
{
|
||||
lldbg("ERROR: Stack pointer is not within allocated stack\n");
|
||||
return;
|
||||
@@ -107,6 +128,20 @@ static void up_stackdump(void)
|
||||
ptr[4], ptr[5], ptr[6], ptr[7]);
|
||||
}
|
||||
}
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
int regs;
|
||||
|
||||
for (regs = REG_R0; regs <= REG_R15; regs += 8)
|
||||
{
|
||||
uint32 *ptr = (uint32*)¤t_regs[regs];
|
||||
lldbg("R%d: %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
regs, ptr[0], ptr[1], ptr[2], ptr[3],
|
||||
ptr[4], ptr[5], ptr[6], ptr[7]);
|
||||
}
|
||||
lldbg("CPSR: %08x\n", current_regs[REG_CPSR]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define up_stackdump()
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* processor, etc. This value is retained only for debug
|
||||
* purposes.
|
||||
* stack_alloc_ptr: Pointer to allocated stack
|
||||
* adj_stack_ptr: Adjusted StatckAllocPtr for HW. The
|
||||
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
|
||||
* initial value of the stack pointer.
|
||||
*
|
||||
* Inputs:
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
@@ -46,6 +48,15 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
* debug is not selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
@@ -64,5 +75,7 @@
|
||||
|
||||
void up_dataabort(uint32 *regs)
|
||||
{
|
||||
lldbg("Data abort at 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* up_doirq.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
@@ -31,73 +31,89 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include "dm320.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* Public Data
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/********************************************************************************
|
||||
* Public Funtions
|
||||
************************************************************/
|
||||
********************************************************************************/
|
||||
|
||||
void up_doirq(int irq, uint32* regs)
|
||||
void up_doirq(uint32* regs)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||
lib_lowprintf("Unexpected IRQ\n");
|
||||
current_regs = regs;
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
#else
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
/* Decode the interrupt. First, fetch the interrupt id register. */
|
||||
|
||||
uint16 irqentry = getreg16(DM320_INTC_IRQENTRY0);
|
||||
|
||||
/* The irqentry value is an offset into a table. Zero means no interrupt. */
|
||||
|
||||
if (irqentry != 0)
|
||||
{
|
||||
/* Current regs non-zero indicates that we are processing
|
||||
* an interrupt; current_regs is also used to manage
|
||||
* interrupt level context switches.
|
||||
*/
|
||||
/* If non-zero, then we can map the table offset into an IRQ number */
|
||||
|
||||
current_regs = regs;
|
||||
int irq = (irqentry >> 2) - 1;
|
||||
|
||||
/* Mask and acknowledge the interrupt */
|
||||
/* Verify that the resulting IRQ number is valie */
|
||||
|
||||
up_maskack_irq(irq);
|
||||
if ((unsigned)irq < NR_IRQS)
|
||||
{
|
||||
/* Mask and acknowledge the interrupt */
|
||||
|
||||
/* Deliver the IRQ */
|
||||
up_maskack_irq(irq);
|
||||
|
||||
irq_dispatch(irq, regs);
|
||||
/* Current regs non-zero indicates that we are processing an interrupt;
|
||||
* current_regs is also used to manage interrupt level context switches.
|
||||
*/
|
||||
|
||||
/* Indicate that we are no long in an interrupt handler */
|
||||
current_regs = regs;
|
||||
|
||||
current_regs = NULL;
|
||||
/* Deliver the IRQ */
|
||||
|
||||
/* Unmask the last interrupt (global interrupts are still
|
||||
* disabled.
|
||||
*/
|
||||
irq_dispatch(irq, regs);
|
||||
|
||||
current_regs = NULL;
|
||||
up_enable_irq(irq);
|
||||
/* Indicate that we are no long in an interrupt handler */
|
||||
|
||||
current_regs = NULL;
|
||||
|
||||
/* Unmask the last interrupt (global interrupts are still
|
||||
* disabled.
|
||||
*/
|
||||
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -128,7 +128,12 @@ static void _up_dumponexit(FAR _TCB *tcb, FAR void *arg)
|
||||
void _exit(int status)
|
||||
{
|
||||
_TCB* tcb = (_TCB*)g_readytorun.head;
|
||||
irqstate_t flags = irqsave();
|
||||
|
||||
/* Disable interrupts. They will be restored when the next
|
||||
* task is started.
|
||||
*/
|
||||
|
||||
(void)irqsave();
|
||||
|
||||
lldbg("TCB=%p exitting\n", tcb);
|
||||
|
||||
@@ -144,6 +149,13 @@ void _exit(int status)
|
||||
|
||||
(void)sched_removereadytorun(tcb);
|
||||
|
||||
/* We are not in a bad stack-- the head of the ready to run task list
|
||||
* does not correspond to the thread that is running. Disabling pre-
|
||||
* emption on this TCB should be enough to keep things stable.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
|
||||
/* Move the TCB to the specified blocked task list and delete it */
|
||||
|
||||
sched_addblocked(tcb, TSTATE_TASK_INACTIVE);
|
||||
@@ -158,6 +170,10 @@ void _exit(int status)
|
||||
(void)sched_mergepending();
|
||||
}
|
||||
|
||||
/* Now calling sched_unlock() should have no effect */
|
||||
|
||||
sched_unlock();
|
||||
|
||||
/* Now, perform the context switch to the new ready-to-run task at the
|
||||
* head of the list.
|
||||
*/
|
||||
|
||||
@@ -277,10 +277,14 @@ __start:
|
||||
|
||||
bl up_boot
|
||||
|
||||
/* Set up the LEDs */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
bl up_ledinit
|
||||
#endif
|
||||
/* Perform early serial initialization */
|
||||
|
||||
#ifdef CONFIG_DEV_CONSOLE
|
||||
mov fp, #0
|
||||
bl up_earlyserialinit
|
||||
#endif
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#undef CONFIG_SUPPRESS_TIMER_INTS /* No timer */
|
||||
#undef CONFIG_SUPPRESS_SERIAL_INTS /* Console will poll */
|
||||
#undef CONFIG_SUPPRESS_UART_CONFIG /* Do not reconfig UART */
|
||||
#undef CONFIG_DUMP_ON_EXIT /* Dumpt task state on exit */
|
||||
#define CONFIG_DUMP_ON_EXIT 1 /* Dump task state on exit */
|
||||
|
||||
/************************************************************
|
||||
* Public Types
|
||||
@@ -101,7 +101,7 @@ extern void up_boot(void);
|
||||
extern void up_copystate(uint32 *dest, uint32 *src);
|
||||
extern void up_dataabort(uint32 *regs);
|
||||
extern void up_delay(int milliseconds);
|
||||
extern void up_doirq(int irq, uint32* regs);
|
||||
extern void up_doirq(uint32* regs);
|
||||
extern void up_fullcontextrestore(uint32 *regs) __attribute__ ((noreturn));
|
||||
extern void up_irqinitialize(void);
|
||||
extern void up_prefetchabort(uint32 *regs);
|
||||
@@ -144,6 +144,18 @@ extern void up_timerinit(void);
|
||||
|
||||
extern void up_maskack_irq(int irq);
|
||||
|
||||
/* Defined in board/up_leds.c */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
extern void up_ledinit(void);
|
||||
extern void up_ledon(int led);
|
||||
extern void up_ledoff(int led);
|
||||
#else
|
||||
# define up_ledinit()
|
||||
# define up_ledon(led)
|
||||
# define up_ledoff(led)
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __UP_INTERNAL_H */
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
@@ -47,6 +48,15 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
* debug is not selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
@@ -65,5 +75,7 @@
|
||||
|
||||
void up_prefetchabort(uint32 *regs)
|
||||
{
|
||||
lldbg("Prefetch abort at 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, boolean enable)
|
||||
static int up_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
#ifdef CONFIG_SUPPRESS_UART_CONFIG
|
||||
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
uint16 brsr;
|
||||
|
||||
/* Clear fifos */
|
||||
@@ -292,7 +292,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
/* Set rx and tx triggers */
|
||||
|
||||
up_serialout(priv, UART_DM320_RFCR, UART_RFCR_RTL_1);
|
||||
up_serialout(priv, UART_DM320_TFCR, UART_TFCR_TTL_1);
|
||||
up_serialout(priv, UART_DM320_TFCR, UART_TFCR_TTL_16);
|
||||
|
||||
/* Set up the MSR */
|
||||
|
||||
@@ -391,7 +391,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
|
||||
static void up_shutdown(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
up_disableuartint(priv, NULL);
|
||||
}
|
||||
|
||||
@@ -413,8 +413,7 @@ static int up_interrupt(int irq, void *context)
|
||||
struct uart_dev_s *dev = NULL;
|
||||
struct up_dev_s *priv;
|
||||
uint16 status;
|
||||
int passes;
|
||||
|
||||
int passes = 0;
|
||||
|
||||
if (g_uart1port.irq == irq)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
#include "dm320.h"
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
@@ -47,6 +48,15 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
* debug is not selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
@@ -78,5 +88,7 @@
|
||||
|
||||
void up_syscall(uint32 *regs)
|
||||
{
|
||||
lldbg("Syscall from 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
PANIC(OSERR_ERREXCEPTION);
|
||||
}
|
||||
|
||||
@@ -132,20 +132,18 @@ int up_timerisr(int irq, uint32 *regs)
|
||||
|
||||
void up_timerinit(void)
|
||||
{
|
||||
uint32 val;
|
||||
|
||||
up_disable_irq(DM320_IRQ_SYSTIMER);
|
||||
|
||||
/* Start timer0 running so that an interrupt is generated at
|
||||
* the rate MSEC_PER_TICK.
|
||||
*/
|
||||
|
||||
putreg16(DM320_TMR0_PRSCL, DM320_TIMER1_TMPRSCL); /* Timer 0 Prescalar */
|
||||
putreg16(DM320_TMR0_DIV, DM320_TIMER1_TMDIV); /* Timer 0 Divisor (count) */
|
||||
putreg16(DM320_TMR0_PRSCL, DM320_TIMER0_TMPRSCL); /* Timer 0 Prescalar */
|
||||
putreg16(DM320_TMR0_DIV, DM320_TIMER0_TMDIV); /* Timer 0 Divisor (count) */
|
||||
|
||||
/* Start the timer */
|
||||
|
||||
putreg16(DM320_TMR0_MODE, DM320_TIMER1_TMMD); /* Timer 0 Mode */
|
||||
putreg16(DM320_TMR0_MODE, DM320_TIMER0_TMMD); /* Timer 0 Mode */
|
||||
|
||||
/* Attach and enable the timer interrupt */
|
||||
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
/* Output debug info if stack dump is selected -- even if
|
||||
* debug is not selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_STACKDUMP
|
||||
# undef lldbg
|
||||
# define lldbg lib_lowprintf
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
@@ -64,5 +73,7 @@
|
||||
|
||||
void up_undefinedinsn(uint32 *regs)
|
||||
{
|
||||
lldbg("Undefined instruction at 0x%x\n", regs[REG_PC]);
|
||||
current_regs = regs;
|
||||
PANIC(OSERR_UNDEFINEDINSN);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* processor, etc. This value is retained only for debug
|
||||
* purposes.
|
||||
* stack_alloc_ptr: Pointer to allocated stack
|
||||
* adj_stack_ptr: Adjusted StatckAllocPtr for HW. The
|
||||
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
|
||||
* initial value of the stack pointer.
|
||||
*
|
||||
* Inputs:
|
||||
|
||||
@@ -124,21 +124,10 @@ up_vectorirq:
|
||||
add r0, sp, #(4*REG_SP) /* Offset to pc, cpsr storage */
|
||||
stmia r0, {r1-r4}
|
||||
|
||||
/* Now decode the interrupt. First, fetch the interrupt id register. */
|
||||
|
||||
ldr r1, =DM320_INTC_IRQENTRY0 /* Addr LS 16-bits of entry */
|
||||
ldrh r0, [r1] /* LS 16-bits of entry */
|
||||
movs r0, r0, lsr #2 /* Convert to index (set Z) */
|
||||
beq .Lnoirqset /* Exit if no IRQ set */
|
||||
|
||||
sub r0, r0, #1 /* Otherwise, offset */
|
||||
|
||||
/* Then call the IRQ handler with interrupt disabled.
|
||||
* rq_dispatch(int irq, struct xcptcontext *xcp)
|
||||
*/
|
||||
/* Then call the IRQ handler with interrupts disabled. */
|
||||
|
||||
mov fp, #0 /* Init frame pointer */
|
||||
mov r1, sp /* Get r1=xcp */
|
||||
mov r0, sp /* Get r1=xcp */
|
||||
bl up_doirq /* Call the handler */
|
||||
|
||||
/* Restore the CPSR, SVC modr registers and return */
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN 0x80
|
||||
#define SCHAR_MAX 0x7f
|
||||
#define UCHAR_MAX 0xff
|
||||
|
||||
@@ -48,8 +48,7 @@ CSRCS = up_initialize.c up_idle.c up_interruptcontext.c \
|
||||
up_releasepending.c up_reprioritizertr.c \
|
||||
up_exit.c up_assert.c up_allocateheap.c \
|
||||
up_irq.c up_savecontext.c up_restorecontext.c \
|
||||
up_timerisr.c up_putc.c up_debug.c up_leds.c \
|
||||
up_delay.c
|
||||
up_timerisr.c up_putc.c up_debug.c up_delay.c
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
SRCS = $(SSRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
@@ -70,6 +69,8 @@ TESTOBJS = $(TESTSRCS:.c=$(OBJEXT))
|
||||
TESTLINKOBJS = up_head$(OBJEXT)
|
||||
TESTEXTRAOBJS = up_savecontext$(OBJEXT) up_restorecontext$(OBJEXT)
|
||||
|
||||
BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
|
||||
|
||||
IRAM_SIZE = 0x100
|
||||
DEF_STACK_BASE = 0x24
|
||||
LDFLAGS = --model-large --nostdlib \
|
||||
@@ -163,16 +164,23 @@ $(SDCCLIBDIR)/libmysdcc.lib: $(SDCCLIBDIR)/libsdcc.lib
|
||||
> libmysdcc.lib
|
||||
@sudo mv -f libmysdcc.lib $(SDCCLIBDIR)/libmysdcc.lib
|
||||
|
||||
# This builds the libboard library in the board/ subdirectory
|
||||
|
||||
board/libboard$(LIBEXT):
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) libboard$(LIBEXT)
|
||||
|
||||
# This target builds the final executable
|
||||
|
||||
pass1.ihx: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS)
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) $(SDCCPATH) $(LINKOBJS) $(LDLIBS) $(SDCCLIBS) -o $@
|
||||
pass1.ihx: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS) board/libboard$(LIBEXT)
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
|
||||
$(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
|
||||
@rm -f up_mem.h
|
||||
@rm -f up_allocateheap$(OBJEXT) libarch$(LIBEXT)
|
||||
@$(MAKE) TOPDIR=$(TOPDIR) libarch$(LIBEXT)
|
||||
|
||||
nuttx.ihx: up_mem.h $(SDCCLIBDIR)/libmysdcc.lib $(LINKOBJS)
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) $(SDCCPATH) $(LINKOBJS) $(LDLIBS) $(SDCCLIBS) -o $@
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) -L$(BOARDDIR) $(SDCCPATH) $(LINKOBJS) \
|
||||
$(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
|
||||
|
||||
nuttx$(EXEEXT): pass1.ihx nuttx.ihx
|
||||
@rm -f pass1.*
|
||||
@@ -191,17 +199,26 @@ irqtest:
|
||||
# Build dependencies
|
||||
|
||||
.depend: Makefile up_mem.h $(DEPSRCS)
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) depend ; \
|
||||
if
|
||||
$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) clean ; \
|
||||
fi
|
||||
rm -f libarch$(LIBEXT) up_mem.h
|
||||
rm -f *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.ihx *.hex *~
|
||||
if [ ! -z "$(OBJEXT)" ]; then rm -f *$(OBJEXT); fi
|
||||
|
||||
distclean: clean
|
||||
@if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board TOPDIR=$(TOPDIR) distclean ; \
|
||||
fi
|
||||
rm -f Make.dep .depend
|
||||
|
||||
-include Make.dep
|
||||
|
||||
@@ -90,6 +90,13 @@ void _exit(int status)
|
||||
|
||||
(void)sched_removereadytorun(tcb);
|
||||
|
||||
/* We are not in a bad stack-- the head of the ready to run task list
|
||||
* does not correspond to the thread that is running. Disabling pre-
|
||||
* emption on this TCB should be enough to keep things stable.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
|
||||
/* Move the TCB to the specified blocked task list and delete it */
|
||||
|
||||
sched_addblocked(tcb, TSTATE_TASK_INACTIVE);
|
||||
@@ -104,6 +111,10 @@ void _exit(int status)
|
||||
(void)sched_mergepending();
|
||||
}
|
||||
|
||||
/* Now calling sched_unlock() should have no effect */
|
||||
|
||||
sched_unlock();
|
||||
|
||||
/* Now, perform the context switch to the new ready-to-run task at the
|
||||
* head of the list.
|
||||
*/
|
||||
|
||||
@@ -42,8 +42,11 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <arch/irq.h>
|
||||
#ifdef CONFIG_ARCH_PJRC
|
||||
# include "pjrc.h"
|
||||
|
||||
#if defined(CONFIG_BOARD_PJRC_87C52)
|
||||
# include <arch/board/pjrc.h>
|
||||
#else
|
||||
# warning "805x board not recognized"
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
@@ -131,7 +134,7 @@ extern void up_dumpframe(FAR struct xcptcontext *context);
|
||||
# define up_dumpframe(x)
|
||||
#endif
|
||||
|
||||
/* Defined in up_leds.c */
|
||||
/* Defined in board/up_leds.c */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
extern void up_ledinit(void);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define CHAR_BIT 8
|
||||
#define SCHAR_MIN 0x80
|
||||
#define SCHAR_MAX 0x7f
|
||||
#define UCHAR_MAX 0xff
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
* processor, etc. This value is retained only for debug
|
||||
* purposes.
|
||||
* stack_alloc_ptr: Pointer to allocated stack
|
||||
* adj_stack_ptr: Adjusted StatckAllocPtr for HW. The
|
||||
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
|
||||
* initial value of the stack pointer.
|
||||
*
|
||||
* Inputs:
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
void _exit(int status)
|
||||
{
|
||||
_TCB* tcb = (_TCB*)g_readytorun.head;
|
||||
irqstate_t flags;
|
||||
|
||||
dbg("TCB=%p exitting\n", tcb);
|
||||
|
||||
@@ -83,13 +84,20 @@ void _exit(int status)
|
||||
|
||||
(void)sched_removereadytorun(tcb);
|
||||
|
||||
/* We are not in a bad stack-- the head of the ready to run task list
|
||||
* does not correspond to the thread that is running. Disabling pre-
|
||||
* emption on this TCB should be enough to keep things stable.
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
|
||||
/* Move the TCB to the specified blocked task list and delete it */
|
||||
|
||||
sched_addblocked(tcb, TSTATE_TASK_INACTIVE);
|
||||
task_delete(tcb->pid);
|
||||
|
||||
/* If there are any pending tasks, then add them to the g_readytorun
|
||||
* task list now
|
||||
* task list now.
|
||||
*/
|
||||
|
||||
if (g_pendingtasks.head)
|
||||
@@ -97,6 +105,10 @@ void _exit(int status)
|
||||
(void)sched_mergepending();
|
||||
}
|
||||
|
||||
/* Now calling sched_unlock() should have no effect */
|
||||
|
||||
sched_unlock();
|
||||
|
||||
/* Now, perform the context switch to the new ready-to-run task at the
|
||||
* head of the list.
|
||||
*/
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
* processor, etc. This value is retained only for debug
|
||||
* purposes.
|
||||
* stack_alloc_ptr: Pointer to allocated stack
|
||||
* adj_stack_ptr: Adjusted StatckAllocPtr for HW. The
|
||||
* adj_stack_ptr: Adjusted stack_alloc_ptr for HW. The
|
||||
* initial value of the stack pointer.
|
||||
*
|
||||
* Inputs:
|
||||
|
||||
256
configs/README.txt
Normal file
256
configs/README.txt
Normal file
@@ -0,0 +1,256 @@
|
||||
Board-Specific Configurations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Table of Contents
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
o Board-Specific Configurations
|
||||
o Summary of Files
|
||||
o Supported Architectures
|
||||
o Configuring NuttX
|
||||
|
||||
Board-Specific Configurations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The NuttX configuration consists of:
|
||||
|
||||
o Processor architecture specific files. These are the files contained
|
||||
in the arch/<arch-name>/ directory.
|
||||
|
||||
o Chip/SoC specific files. Each processor processor architecture
|
||||
is embedded in chip or System-on-a-Chip (SoC) architecture. The
|
||||
full chip architecture includes the processor architecture plus
|
||||
chip-specific interrupt logic, general purpose I/O (GIO) logic, and
|
||||
specialized, internal peripherals (such as UARTs, USB, etc.).
|
||||
|
||||
These chip-specific files are contained within chip-specific
|
||||
sub-directories in the arch/<arch-name>/ directory and are selected
|
||||
via the CONFIG_ARCH_name selection
|
||||
|
||||
o Board specific files. In order to be usable, the chip must be
|
||||
contained in a board environment. The board configuration defines
|
||||
additional properties of the board including such things as
|
||||
peripheral LEDs, external peripherals (such as network, USB, etc.).
|
||||
|
||||
These board-specific configuration files can be found in the
|
||||
configs/<board-name>/ sub-directories and are discussed in this
|
||||
README.
|
||||
|
||||
The configs/ subdirectory contains configuration data for each board. These
|
||||
board-specific configurations plus the architecture-specific configurations in
|
||||
the arch/ subdirectory completely define a customized port of NuttX.
|
||||
|
||||
Directory Structure
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The configs directory contains board specific configurationlogic. Each
|
||||
board must provide a subdirectory <board-name> under configs/ with the
|
||||
following characteristics:
|
||||
|
||||
|
||||
<board-name>
|
||||
|-- include/
|
||||
| `-- (board-specific header files)
|
||||
|-- src/
|
||||
| |-- Makefile
|
||||
| `-- (board-specific source files)
|
||||
|-- Make.defs
|
||||
|-- defconfig
|
||||
`-- setenv.sh
|
||||
|
||||
Summary of Files
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
include/ -- This directory contains board specific header files. This
|
||||
directory will be linked as include/arch/board at configuration time and
|
||||
can be included via '#include <arch/board/header.h>'. These header file
|
||||
can only be included by files in arch/<arch-name>include/ and
|
||||
arch/<arch-name>/src
|
||||
|
||||
src/ -- This directory contains board specific drivers. This
|
||||
directory will be linked as arch/<arch-name>/src/board at configuration
|
||||
time and will be integrated into the build system.
|
||||
|
||||
src/Makefile -- This makefile will be invoked to build the board specific
|
||||
drivers. It must support the following targets: libext$(LIBEXT), clean,
|
||||
and distclean.
|
||||
|
||||
Make.defs -- This makefile fragment provides architecture and
|
||||
tool-specific build options. It will be included by all other
|
||||
makefiles in the build (once it is installed). This make fragment
|
||||
should define:
|
||||
|
||||
Tools: CC, LD, AR, NM, OBJCOPY, OBJDUMP
|
||||
Tool options: CFLAGS, LDFLAGS
|
||||
|
||||
When this makefile fragment runs, it will be passed TOPDIR which
|
||||
is the path to the root directory of the build. This makefile
|
||||
fragment may include ${TOPDIR}/.config to perform configuration
|
||||
specific settings. For example, the CFLAGS will most likely be
|
||||
different if CONFIG_DEBUG=y.
|
||||
|
||||
defconfig -- This is a configuration file similar to the Linux
|
||||
configuration file. In contains varialble/value pairs like:
|
||||
|
||||
CONFIG_VARIABLE=value
|
||||
|
||||
This configuration file will be used at build time:
|
||||
|
||||
(1) as a makefile fragment included in other makefiles, and
|
||||
(2) to generate include/nuttx/config.h which is included by
|
||||
most C files in the system.
|
||||
|
||||
The following variables are recognized by the build (you may
|
||||
also include architecture/board-specific settings).
|
||||
|
||||
Architecture selection:
|
||||
|
||||
CONFIG_ARCH - identifies the arch/ subdirectory
|
||||
CONFIG_ARCH_name - for use in C code
|
||||
|
||||
General OS setup
|
||||
|
||||
CONFIG_EXAMPLE - identifies the subdirectory in examples
|
||||
that will be used in the build
|
||||
CONFIG_DEBUG - enables built-in debug options
|
||||
CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot
|
||||
time console output
|
||||
CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
regions of memory to allocate from, this specifies the
|
||||
number of memory regions that the memory manager must
|
||||
handle and enables the API mm_addregion(start, end);
|
||||
CONFIG_RR_INTERVAL - The round robin timeslice will be set
|
||||
this number of milliseconds; Round robin scheduling can
|
||||
be disabled by setting this value to zero.
|
||||
CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
|
||||
scheduler to monitor system performance
|
||||
CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a
|
||||
task name to save in the TCB. Useful if scheduler
|
||||
instrumentation is selected. Set to zero to disable.
|
||||
CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
|
||||
Used to initialize the internal time logic.
|
||||
CONFIG_JULIAN_TIME - Enables Julian time conversions
|
||||
CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
provides /dev/console. Enables stdout, stderr, stdin.
|
||||
|
||||
The following can be used to disable categories of APIs supported
|
||||
by the OS. If the compiler supports weak functions, then it
|
||||
should not be necessary to disable functions unless you want to
|
||||
restrict usage of those APIs.
|
||||
|
||||
There are certain dependency relationships in these features.
|
||||
|
||||
o mq_notify logic depends on signals to awaken tasks
|
||||
waiting for queues to become full or empty.
|
||||
o pthread_condtimedwait() depends on signals to wake
|
||||
up waiting tasks.
|
||||
|
||||
CONFIG_DISABLE_CLOCK, CONFIG_DISABLE_POSIX_TIMERS, CONFIG_DISABLE_PTHREAD.
|
||||
CONFIG_DISABLE_SIGNALS, CONFIG_DISABLE_MQUEUE
|
||||
|
||||
|
||||
Misc libc settings
|
||||
|
||||
CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
little smaller if we do not support fieldwidthes
|
||||
|
||||
Allow for architecture optimized implementations
|
||||
|
||||
The architecture can provide optimized versions of the
|
||||
following to improve sysem performance
|
||||
|
||||
CONFIG_ARCH_MEMCPY, CONFIG_ARCH_MEMCMP, CONFIG_ARCH_MEMMOVE
|
||||
CONFIG_ARCH_MEMSET, CONFIG_ARCH_STRCMP, CONFIG_ARCH_STRCPY
|
||||
CONFIG_ARCH_STRNCPY, CONFIG_ARCH_STRLEN, CONFIG_ARCH_BZERO
|
||||
CONFIG_ARCH_KMALLOC, CONFIG_ARCH_KZMALLOC, CONFIG_ARCH_KFREE
|
||||
|
||||
Sizes of configurable things (0 disables)
|
||||
|
||||
CONFIG_MAX_TASKS - The maximum number of simultaneously
|
||||
active tasks. This value must be a power of two.
|
||||
CONFIG_NPTHREAD_KEYS - The number of items of thread-
|
||||
specific data that can be retained
|
||||
CONFIG_NFILE_DESCRIPTORS - The maximum number of file
|
||||
descriptors (one for each open)
|
||||
CONFIG_NFILE_STREAMS - The maximum number of streams that
|
||||
can be fopen'ed
|
||||
CONFIG_NAME_MAX - The maximum size of a file name.
|
||||
CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
|
||||
on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
CONFIG_NUNGET_CHARS - Number of characters that can be
|
||||
buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
|
||||
structures. The system manages a pool of preallocated
|
||||
message structures to minimize dynamic allocations
|
||||
CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
|
||||
a fixed payload size given by this settin (does not include
|
||||
other message structure overhead.
|
||||
CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
|
||||
structures. The system manages a pool of preallocated
|
||||
watchdog structures to minimize dynamic allocations
|
||||
|
||||
Stack and heap information
|
||||
|
||||
CONFIG_BOOT_FROM_FLASH - Some configurations support XIP
|
||||
operation from FLASH.
|
||||
CONFIG_STACK_POINTER - The initial stack pointer
|
||||
CONFIG_PROC_STACK_SIZE - The size of the initial stack
|
||||
CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
|
||||
CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
|
||||
CONFIG_HEAP_BASE - The beginning of the heap
|
||||
CONFIG_HEAP_SIZE - The size of the heap
|
||||
|
||||
setenv.sh -- This is a script that you can include that will be installed at
|
||||
the toplevel of the directory structure and can be sourced to set any
|
||||
necessary environment variables.
|
||||
|
||||
Supported Boards
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
configs/sim
|
||||
A user-mode port of NuttX to the x86 Linux platform is available.
|
||||
The purpose of this port is primarily to support OS feature developement.
|
||||
This port does not support interrupts or a real timer (and hence no
|
||||
round robin scheduler) Otherwise, it is complete.
|
||||
|
||||
configs/c5471evm
|
||||
This is a port to the Spectrum Digital C5471 evaluation board. The
|
||||
C5471 is a dual core processor from TI with an ARM7TDMI general purpose
|
||||
processor and a c54 SDP. NuttX runs on the ARM core and is built with
|
||||
with a GNU arm-elf toolchain*. This port is complete, verified, and
|
||||
included in the NuttX release.
|
||||
|
||||
configs/ntosd-dm320
|
||||
This port uses the Neuros OSD with a GNU arm-elf toolchain*:
|
||||
see http://wiki.neurostechnology.com/index.php/Developer_Welcome .
|
||||
NuttX operates on the ARM9EJS of this dual core processor.
|
||||
STATUS: This port is code complete, verified, and included in the
|
||||
NuttX 0.2.1 release.
|
||||
|
||||
configs/m68322evb
|
||||
This is a work in progress for the venerable m68322evb board from
|
||||
Motorola.
|
||||
|
||||
configs/pjrc-8051
|
||||
8051 Microcontroller. This port uses the PJRC 87C52 development system
|
||||
and the SDCC toolchain. This port is not quite ready for prime time.
|
||||
|
||||
Other ports for the for the TI TMS320DM270, M683222 and for MIPS are in various
|
||||
states of progress
|
||||
|
||||
Configuring NuttX
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Configuring NuttX requires only copying
|
||||
|
||||
configs/<board-name>/Make.def to ${TOPDIR}/Make.defs
|
||||
configs/<board-name>/setenv.sh to ${TOPDIR}/setenv.sh
|
||||
configs/<board-name>/defconfig to ${TOPDIR}/.config
|
||||
|
||||
There is a script that automates these steps. The following steps will
|
||||
accomplish the same configuration:
|
||||
|
||||
cd tools
|
||||
./configure.sh <board-name>
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHSCRIPT = -T$(TOPDIR)/arch/$(CONFIG_ARCH)/ld.script
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_BOARD)/ld.script
|
||||
|
||||
CROSSDEV = arm-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
@@ -35,20 +35,28 @@
|
||||
#
|
||||
# architecture selection
|
||||
#
|
||||
# CONFIG_ARCH - identifies the arch subdirectory
|
||||
# CONFIG_ARCH_name - for use in C code
|
||||
# CONFIG_ARCH - identifies the arch subdirectory and, hence, the
|
||||
# processor architecture.
|
||||
# CONFIG_ARCH_name - for use in C code. This identifies the
|
||||
# particular chip or SoC that the architecture is implemented
|
||||
# in.
|
||||
# CONFIG_BOARD - identifies the configs subdirectory and, hence,
|
||||
# the board that supports the particular chip or SoC.
|
||||
# CONFIG_BOARD_name - for use in C code
|
||||
# CONFIG_ROM_VECTORS - unique to c5471
|
||||
# CONFIG_DRAM_END - the size of installed DRAM.
|
||||
# Unique to c5471
|
||||
# CONFIG_C5471_LEDS - Use LEDs to show state. Unique to c5471.
|
||||
# CONFIG_C5471_STACKDUMP - Do stack dumps after assertions
|
||||
# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to c5471.
|
||||
# CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||
#
|
||||
CONFIG_ARCH=c5471
|
||||
CONFIG_ARCH_C5471=y
|
||||
CONFIG_BOARD=c5471evm
|
||||
CONFIG_BOARD_C5471EVM=y
|
||||
CONFIG_ROM_VECTORS=n
|
||||
CONFIG_DRAM_END=0x11000000
|
||||
CONFIG_C5471_LEDS=y
|
||||
CONFIG_C5471_STACKDUMP=y
|
||||
CONFIG_ARCH_LEDS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
|
||||
#
|
||||
# C5471 specific device driver settings
|
||||
@@ -138,6 +146,7 @@ CONFIG_DEV_CONSOLE=y
|
||||
# up waiting tasks.
|
||||
#
|
||||
CONFIG_DISABLE_CLOCK=n
|
||||
CONFIG_DISABLE_POSIX_TIMERS=n
|
||||
CONFIG_DISABLE_PTHREAD=n
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
@@ -207,6 +216,10 @@ CONFIG_RRLOAD_BINARY=y
|
||||
# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
|
||||
# structures. The system manages a pool of preallocated
|
||||
# watchdog structures to minimize dynamic allocations
|
||||
# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX
|
||||
# timer structures. The system manages a pool of preallocated
|
||||
# timer structures to minimize dynamic allocations. Set to
|
||||
# zero for all dynamic allocations.
|
||||
#
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_MAX_TASK_ARGS=4
|
||||
@@ -220,6 +233,7 @@ CONFIG_PREALLOC_MQ_MSGS=32
|
||||
CONFIG_MQ_MAXMSGSIZE=32
|
||||
CONFIG_MAX_WDOGPARMS=4
|
||||
CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user