Compare commits

...

16 commits

Author SHA1 Message Date
Brennan Ashton
561cbbca96 tcp: Remove incomplete support for TCP reassembly 2020-12-05 21:46:18 -08:00
Gregory Nutt
b34096a4fa net/tcp/tcp_input.c: Correct bad check of urgent data length
Urgent data preceded "normal" data in the TCP payload.  If the urgent data is larger than the size of the TCP payload, this indicates that the entire payload is urgent data and that urgent data continues in the next packet.

This case was handled correctly for the case where urgent data was present but was not being handled correctly in the case where the urgent data was NOT present.
2020-12-05 21:45:45 -08:00
Ouss4
e4e4cce696 tools/zipme.sh: Remove the option to exclude patterns based on the VCS'
"ignore" file.
2020-07-07 16:58:28 -07:00
Xiang Xiao
569477d36c board/sim: Don't ignore any files under src/etc/ folder
see the discussion here:
https://github.com/apache/incubator-nuttx/issues/1363
2020-07-07 16:56:48 -07:00
Gregory Nutt
8cb06171a3 Do not ignore .asm files that are tracked. 2020-07-07 16:56:48 -07:00
Brennan Ashton
201f920c3b nxstyle: fixup style issues in mm_realloc.c
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-06-29 17:10:26 -06:00
Brennan Ashton
3b1dca8167 mm: Do not memcopy more than oldsize when realloc
When realloc up from a mem area to a larger one where a new node
is needed. The the larger memory region is copied from the source
this can both leak data as well as cause memory faults accesssing
invalid data.

This was first reported by Kwonsk

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-06-29 17:10:26 -06:00
Alin Jerpelea
c6f8a6b069 tools: cxd56: nxstyle fixes
nxstyle fixes to pass the CI checks

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-06-29 17:28:23 +01:00
Alin Jerpelea
256005cc7b tools: cxd56: mkspk: fix out of tree MAC build
The local copy of elf headers is needed for the MAC systems which miss the ELF headers.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2020-06-29 17:28:23 +01:00
Masayuki Ishikawa
194734f49b libs: rv64: Fix _calc_imm() in arch_elf.c 2020-06-25 22:43:50 -07:00
Xiang Xiao
bd12fb6b64 tools/version.sh: Make it invokable from everywhere
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-25 01:01:05 +01:00
Xiang Xiao
145205767d tools/zipme.sh: Add executable bit
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-25 01:01:05 +01:00
Xiang Xiao
f77a2d690a tools/zipme.sh: Don't move the directory to nuttx/Documentation
and remove the redundancy of "cd ${TRUNKDIR}"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-25 01:01:05 +01:00
Xiang Xiao
546db27b52 tools/zipme.sh: Fix the typo error
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-25 01:01:05 +01:00
Nathan Hartman
5d5e6f7192 Docs and README: Add STM32G474, B-G474E-DPOW1 board
Documentation/NuttX.html:
    Documentation/README.html:
    README.txt:
    boards/README.txt:

        Document initial support for the STM32G474 MCU and
        B-G474E-DPOW1 Discovery kit was added in NuttX-9.1.
2020-06-22 21:57:46 -07:00
Ouss4
874b3a5b11 Update ReleaseNotes in preparation for the 9.1 release. 2020-06-22 21:53:46 -07:00
25 changed files with 663 additions and 305 deletions

View file

@ -1797,6 +1797,7 @@
<li><a href="#stm32f433x">STMicro STM32 F433</a> <small>(STM32 F4 family, ARM Cortex-M4)</small></li> <li><a href="#stm32f433x">STMicro STM32 F433</a> <small>(STM32 F4 family, ARM Cortex-M4)</small></li>
<li><a href="#stm32f446x">STMicro STM32 F446</a> <small>(STM32 F4 family, ARM Cortex-M4)</small></li> <li><a href="#stm32f446x">STMicro STM32 F446</a> <small>(STM32 F4 family, ARM Cortex-M4)</small></li>
<li><a href="#stm32f46xxx">STMicro STM32 F46xx</a> <small>(STM32 F4 family, ARM Cortex-M4)</small></li> <li><a href="#stm32f46xxx">STMicro STM32 F46xx</a> <small>(STM32 F4 family, ARM Cortex-M4)</small></li>
<li><a href="#stm32g474x">STMicro STM32 G474x</a> <small>(STM32 G4 family, ARM Cortex-M4)</small></li>
<li><a href="#stm32l4x2">STMicro STM32 L4x2</a> <small>(STM32 L4 family, ARM Cortex-M4)</small></li> <li><a href="#stm32l4x2">STMicro STM32 L4x2</a> <small>(STM32 L4 family, ARM Cortex-M4)</small></li>
<li><a href="#stm32l475">STMicro STM32 L475</a> <small>(STM32 L4 family, ARM Cortex-M4)</small></li> <li><a href="#stm32l475">STMicro STM32 L475</a> <small>(STM32 L4 family, ARM Cortex-M4)</small></li>
<li><a href="#stm32l476">STMicro STM32 L476</a> <small>(STM32 L4 family, ARM Cortex-M4)</small></li> <li><a href="#stm32l476">STMicro STM32 L476</a> <small>(STM32 L4 family, ARM Cortex-M4)</small></li>
@ -4846,6 +4847,35 @@ nsh>
</td> </td>
</tr> </tr>
<tr>
<td><br></td>
<td><hr></td>
</tr>
<tr>
<td><br></td>
<td>
<p>
<a name="stm32g474x"><b>STMicro STM32 G474</b>.</a>
One board is supported in this family:
</p>
<ul>
<li>
<p>
<b>B-G474E-DPOW1 Discovery Kit</b>.
Initial board support for the STMicro B-G474E-DPOW1 board from ST Micro was added in NuttX-9.1. See the <a href="https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/b-g474e-dpow1.html" target="_blank">STMicro website</a> and the board <a href="https://github.com/apache/incubator-nuttx/blob/master/boards/arm/stm32/b-g474e-dpow1/README.txt" target="_blank">README</a> file for further information.
</p>
</li>
</ul>
<p><b>Status</b>:</p>
<ul>
<p>
<b>NuttX-9.1</b>.
Initial support for booting NuttX to a functional NSH prompt on this board.
</p>
</td>
</tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td><hr></td> <td><hr></td>

View file

@ -232,6 +232,8 @@ nuttx/
| | |- stm32/ | | |- stm32/
| | | |- axoloti/ | | | |- axoloti/
| | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/stm32/axoloti/README.txt" target="_blank"><b><i>README.txt</i></b></a> | | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/stm32/axoloti/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| | | |- b-g474e-dpow1/
| | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/stm32/b-g474e-dpow1/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| | | |- clicker2-stm32/ | | | |- clicker2-stm32/
| | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/stm32/clicker2-stm32/README.txt" target="_blank"><b><i>README.txt</i></b></a> | | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/stm32/clicker2-stm32/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| | | |- cloudctrl/ | | | |- cloudctrl/

View file

@ -2112,6 +2112,8 @@ nuttx/
| | |- stm32/ | | |- stm32/
| | | |- axoloti/ | | | |- axoloti/
| | | | `- README.txt | | | | `- README.txt
| | | |- b-g474e-dpow1/
| | | | `- README.txt
| | | |- clicker2-stm32/ | | | |- clicker2-stm32/
| | | | `- README.txt | | | | `- README.txt
| | | |- cloudctrl/ | | | |- cloudctrl/

View file

@ -26766,3 +26766,357 @@ This is the first release of NuttX as Apache NuttX (Incubating) and represents o
- Fix slcd to avoid using priv->fd before initializing it - Fix slcd to avoid using priv->fd before initializing it
- Fix (tcp, udp)blaster to build on macOS - Fix (tcp, udp)blaster to build on macOS
- Correct the buffer type of base64 program - Correct the buffer type of base64 program
NuttX-9.1.0 Release Notes -------------------------
* Major Changes to Core OS:
* New Features:
- PR-977 PR-987 PR-998 PR-995 PR-997 PR-1007 Thread Local Storage (TLS)
is now a required feature and used by all architectures
There is detailed information on the implementation and how this
impacts errno specifically in the Wiki article: Userspace errno and
TLS
- PR-957 PR-947 PR-963 PR-969 Provide nx_ versions of many functions
that are used internally to avoid disrupting errno in userspace
- PR-965 PR-980 PR-984 ioctl is now always in the variadic form.
Syscalls in KERNEL builds are also more efficient with this as well now.
Previously the ioctl prototype was normally defined as:
int ioctl(int fd, int cmd, unsigned long arg);
unless the CONFIG_LIBC_IOCTL_VARIADIC was enabled in which case it was
int ioctl(int fd, int cmd, ...); This form is now the form defined by
opengroup and is also inline with Linux. Prior to this change there
were issues with making ioctl calls on 64-bit arch since the
implementation assumed that (void *) would be of size long. There is
more discussion of this issue in the GitHub issue ticket here:
https://github.com/apache/incubator-nuttx/issues/959
- PR-962 PR-964 Add new interface sched_get_stackinfo that simplifies
interfaces for things like TLS
There are some security imposed rules for using this interface
Any thread may query its own stack, A kernel thread may query the
stack of any other thread Application threads, however, may query
only the stacks of threads within the same task group, i.e., the
main thread and any of the child pthreads created with the main
thread as a parent or grandparent or great-grandparent.
- PR-1104 Internal function fs_fsopen() no longer affects errno -
- PR-1123 Move task_init() and task_activate() to be internal functions -
- PR-1140 Add nxtask_uninit() interface
This function will undo all operations on a TCB performed by
task_init() and release the TCB by calling kmm_free(). This is
intended primarily to support error recovery operations after a
successful call to task_init() such was when a subsequent call to
task_activate fails.
- PR-1134 Add typedef for max_align_t
- PR-1141 Handle custom stack allocations
sched_releasetcb() will normally free the stack allocated for a task.
However, a task with a custom, user-managed stack may be created using
nxtask_init() followed by nxtask_activate(). If such a custom stack is
used then it must not be freed in this manner or a crash will most
likely result.
This change adds a flag call TCB_FLAG_CUSTOM_STACK that may be passed
in the the pre-allocated TCB to nxtask_init(). This flag is not used
internally anywhere in the OS except that if set, it will prevent
sched_releasetcb() from attempting to free that custom stack.
* Bug Fixes:
- Many private architecture interfaces were using 'up_' instead of the
arch name 'arm_'
This fix is carried over many PRs such as PR-924. Many files also
carried this same error in naming convention and were converted as
well.
- PR-1018 PR-1017 PR-1021 PR-1022 PR-1057 PR-1060 PR-1194 Clean up
internal APIs that were not using the properly naming conventions -
- PR-857 Wrong value for it_interval field in timespec returned by
timer_gettime - PR-902 SMP: On task creation do not clone
uninitialized descriptors
In SMP mode, there is a possibility that a pthread executing one CPU
may create a new task while a pthread on another CPU has allocated
the socket but not yet initialized it. This commit updates the
socket clone test to assure that the socket is both allocated and
initialized before it is cloned.
- PR-911 Use OS signal functions internally to not reset errno that
applications are using
- PR-925 sys/stat.h Change the xtime fields to align with POSIX
standard. Starting from Issue 7 of the POSIX standard the fields
st_atime, st_mtime and st_ctime have a type of strcut timespec instead
of time_t.
- PR-939 openamp: Update to 2020.04.0 - PR-953 lib_vsprintf: Fix issue
where stack would become corrupt on x86_64
This function requires traversing the VA_LIST twice. For some
architectures like x86 and x86_64 this needs to be cloned first.
* Major Changes to the Build System:
Parts of the build system have been refactored to reduce duplication and
simplify Makefile and Make.defs files across many directories. These changes
are particularly beneficial for boards.
Please note that if you develop your own custom boards, you may need to make
some modifications to keep your board's build scripts up-to-date with the
rest of NuttX and avoid a broken or defective build. For details, see
Compatibility Concerns, Changes to Build System, in these release notes.
* New Features:
- PR-894 openamp and libmetal can now be downloaded and configured by
build system - PR-941 Remove 'u' prefix from userspace library in FLAT
Build so it is the same for all build types - PR-1044 ARM: Remove
support for old redundant gcc toolchains
This removes support for the Codesourcery, Atollic, DevKitArm,
Raisonance, and CodeRed toolchains. Not only are these tools old and
no longer used but they are all equivalent to the standard ARM EABI
toolchains. Retaining specific support was not meaningful (and they
are still supported, but now just as generic EABI toolchains).
- PR-1148 PR-1149 Improve build time especially on non-Linux platforms
by providing a C version of incdir.sh
* Bug Fixes:
Many small changes to resolve dependency resolution issues that would
sometimes appear during parallel builds. Parallel builds should be much
more reliable now and bugs filed against any issues found.
- PR-1000 Fix broken support of ZDS-II Toolchain with MSYS
* Architectural Support:
* New Architecture Support:
- PR-879 ARMv8-M support - PR-1051 STM32G474 support
- Initial architectural support for the STM32G474 family of
microcontrollers. In terms of peripherals, currently there is basic
support for the RCC and UART, allowing NuttX to boot to a functional
NSH prompt on this family. Other peripherals on the SoC are not yet
supported and/or not tested yet. Contributions to enable other
peripherals are welcome. This adds support for these variants:
STM32G474C STM32G474M STM32G474R STM32G474Q STM32G474V
* Architectures With Significant Improvements:
- PR-745 The full line of STM32H7 chips are now defined
This adds support for these variants:
STM32H743AG STM32H743AI STM32H743BG STM32H743BI STM32H743IG
STM32H743II STM32H743VG STM32H743VI STM32H743XG STM32H743XI
STM32H743ZG STM32H753AI STM32H753BI STM32H753VI STM32H753XI
STM32H753ZI
- PR-811 i486: Fix corruption of esp register on full context restore
This resolves a long standing issue with running the x86 port under
QEMU where it would crash shortly after boot.
- PR-837 rx65n: Add crashdump support using standby RAM - PR-862
STM32L4: Expose LPTIM timers - PR-868 STM32L4: Extend clock options and
power regulation for based on clock settings
Interface to select the core regulator voltage according to clock
frequency range Usage of this interface during clock configuration
according to chosen clock frequency Option to choose a different
system clock than the main PLL (there is HSI, MSI, HSE and LSE
available to use) Option to not enable the main PLL which allows for
reduced power usage when setting one of the above options as system
clock, to do this you should define STM32L4_BOARD_NOPLL on your
board header.
- PR-960 STM32: Add support for ADC features EXTSEL and JEXTSEL
- PR-1041 STM32H7: Improve IDMA transfer and cache handling
This resolves an issue where the sdmmc driver crashes at boot when
using writeback cache.
This also simplifies the sdmmc driver when the IDMA is in use. There
is no need to mix IDMA and interrupt based transfers; instead, when
making unaligned data tranfers, just make IDMA into an internal
aligned buffer and then copy the data. This method also enables
multiblock transfers, and transfers from/to data buffers which are not
aligned on cache boundary.
- PR-1042 STM32H7: Resolve multiple limitations and bugs with progmem
especailly for partial memory writes
- PR-1045 STM32H7: This gives possibility to send arbitrary number of
bytes from memory to peripheral using DMA also when using write-back
cache
It was not possible to DMA to/from AXI sram if
CONFIG_STM32H7_DMACAPABLE=y When doing TX DMA (e.g. in SPI driver in
simplex-tx mode), it should not be necessary to align the data
buffers to the cache line.
- PR-1103 STM32H7: Resolve clocking and pin configurations bugs that
could cause SDMMC and ETH to fail in some configurations
- PR-1104 STM32H7: Use UUID for Ethernet MAC. This is inline with the
behaviour of STM32F7
- PR-1110 STM32H7: Use FDCANSEL to determin FDCAN clock source if
possible - PR-1165 STM32H7: SPI transaction appears to be completed
before the data has actually been flushed
TX DMA completes before the data has been actually sent out from the
SPI fifo. This is expected, but the exchange should actually wait for
spi tx to finish instead of dma to the fifo to finish. This replaces
the dma completion event with the SPI TXC event for detecting end of
transmission.
- PR-1203 PR-1204 STM32H7: Enable support for BDMA and enable it for
SPI6
- PR-905 x86_64: Resolve linking issue when building with gcc 7 and 9.
- PR-904 x86_64: Resolve compiler aliasing warnings and RNG
pointer cast bug - PR-944 x86_64: Change entrypoint to standard
location 1M
- PR-971 x86_64: Fix bug in rng implementation using intrinsics
- PR-973 x86_64: Fix crash on boot when XSAVE and SSE/AVX is enabled
- PR-974 x86_64: Add support booting NuttX as a Jailhouse Cell
- PR-919 sim: Add host mmap and perror to allow use of LIBC_MODLIB
and BINFMT_LOADABLE
- PR-1198 sim: Use correct errno sign with hostfs interface
- PR-932 z16: Updated toolchain to ZDS-II 5.2.2
- PR-970 K210: Add PLL support
- PR-988 K210: Resolve occasional lock in early boot caused by waiting
forserial driver to initialize
- PR-1205 K210: Add basic GPIOHS support - PR-1112 tiva: Add up_idle
support - PR-1116 NRF52832: Work around chip eratta for SPI Master 1
Byte transfer anomaly - PR-1130 imxrt: Resolve WFI issue by setting
the low power mode to remain in run mode
- PR-1197 cxd56: Fix locking issue in Spresense audio driver causes by
using semaphore in DMA buffer handling code
- PR-1221 Add INTx_C macro defintion
* Driver Support:
* Bug Fixes:
- PR-1206 PR-1207 PR-1210 ioctl function should retun ENOTTY when the
command is not recognized.
* New Driver Support:
- PR-795 PR-1001 Initial NuttX audio driver supporting the Spresense
CXD56
- PR-975 Support for HDC1008 temperature and humidity sensor
- PR-1201 Support for the CS4344 stereo audio DAC
- PR-1145 Support for the FTDI FT232R USB to Serial converter
- PR-1052 gs2200m: Add max payload size to prevent crashing when
sending large packets
- PR-1090 gs2200m: Fix possible packet queue count overflow seen during
streaming - PR-1127 gs2200m: Resolve possible buffer overrun in packet
parsing - PR-1167 pty: Return correct number of bytes when
CONFIG_SERIAL_TERMIOS and OPOST|ONLCR are enabled
* Drivers With Significant Improvements:
- PR-887 PR-888 rptun: Add control for independent control of rx and tx
buffer size
- PR-917 gs2200m: Receive performance improvement for TCP/UDP
- PR-1032 gs2200m: Add SPI-DMA support to spresense
- PR-1046 gs2200m: Add getsockname() support
- PR-1094 PR-1163 gs2200m: Add flow control support to prevent memory
starvation in changing network environments
- PR-1101 gs2200m: Add WPA2-PSK AP mode support, this is now the default
instead of WEP
- PR-1115 SPI slave: Improve interface
Enable enqueue and receive full buffers of data with single call, to
avoid call overhead when sending / receiving large amounts of data.
Enable the slave device to leave received data in the controller
receive buffers and retrieve it from there by polling
- PR-1196 Audio: Add support for using ap_buffer_info without
CONFIG_AUDIO_DRIVER_SPECIFIC_BUFFERS and return ENOTTY if provided ioctl
is not supported
- PR-1222 audio/cxd56: Add audio buffering feature.
* Board Support:
* Significant Improvements:
- PR-1200 The boards_button_initialize and boards_userled_initialize
functions now return the number of buttons and leds, thus their
prototypes have changed from:
void board_button_initialize(void)
void board_userled_initialize(void)
to
uint32_t board_button_initialize(void)
uint32_t board_userled_initialize(void).
* New Board Support:
- PR-1051 ST Micro B-G474E-DPOW1 Discovery Kit
Initial support for the ST Micro B-G474E-DPOW1 Discovery Kit with
STM32G474RE MCU. Currently there is basic support for booting NuttX to
a functional NSH prompt. Other peripherals on the board are not yet
supported or not tested yet. Contributions to enable other peripherals
are welcome. The NSH prompt can be accessed from a host computer via a
Virtual COM Port over the same Micro-USB Type B connection used for
programming/debugging.
- PR-1211 STM32F411-Minimum board (a.k.a. BlackPill)
Initial support for the BlackPill board which is a low cost STM32F411
board. The current support boots NuttX to a functional NSH prompt.
* Boards With Significant Improvements:
- PR-949 qemu-intel64: Add nsh configuration for testing QEMU
virtualization
- PR-966 qemu-i486: Fix issue where console would not accept input
because of wrong IRQ number
- PR-993 stm32h747i-disco: Add support for FMC SDRAM - PR-1029 maix-bit:
Add knsh configuration for testing Kernel mode under QEMU virtualization
- PR-1056 stm32h747i-disco: Add support for FAT and SD Card via SDMMC
- PR-1070 PR-1086 spresense: Add ftpd/ftpc and nxplayer to wifi and rndis
configurations
- PR-1084 imxrt1060-evk: Add dns client and renew command to netnsh
configuration
- PR-1113 lm3s6965ek: Use proper sysclock for QEMU
configuration
- PR-1229 Add support for the inboard joystick
- PR-1232 Architectural re-organization to the initialization of the
video stream driver to comply with other NuttX drivers
* File System:
* Bug Fixes:
- PR-918 tmpfs: Calling statfs could cause files to be removed
recursively - PR-1142 NFS: Use of uint64_t causes issues with gaps in
data since it must be on a 8 byte boundary
- PR-1143 Report correct stats for proxied block and MTD drivers
* Significant Improvements:
- PR-793 Allow use of genromfs to geneate ROMFS
- PR-851 Upgrade littlefs to v2.2.1
- PR-1154 FATFS: Do not rewrite the root directory if it has not been
changed.
- PR-1120 PR-1118 Fill in file size for mtd and block inode
* Networking:
- PR-807 Netlink: Broadcast link status changes to userspace via
RTNLGRP_LINK
- PR-892 Netdb: Multiple DNS Servers
Adds capability to add multiple nameservers on run-time even when not
using resolv.conf and reset the list of nameservers back to default
setting (no nameserver at all or single predefined nameserver in Kconfig).
This is useful for applications that change their cellular network
frequently.
- PR-1015 tcp/conn: Request ARP before 3-way handshake
* Applications:
* Improvements:
- PR-185 PR-828 nshlib
Add the source command. Avoid use of sh where it is not needed since
it pollutes the parent environment including the working directory and
variables.
- PR-236 littlevgl: Add additional config mappings to the library
- PR-264 nxplayer: Add max host and filename for http url
- PR-260 nshlib: Add wget buffer size control with
CONFIG_NSH_WGET_BUFF_SIZE
- PR-243 dhcpd: Add ability for daemon to be cancelled
- PR-238 Remove use the set_errno this is now properly handled by the
libc and OS
- PR-233 hdc1008: Add example application for this driver
* Bug Fixes:
- PR-282 netlib: Fix pathlen computation for netlib_parseurl and
netlib_parsehttpurl
- PR-281 webclient: Check return value of netlib_parseurl correctly
- PR-278 webclient: Handle http/https redirection correctly
- PR-277 webclient: Limit the number of http redirects
- PR-198 webclient: Use getaddrinfo() to get IPv4 address on
dual stack systems
- PR-268 ftpd: Fix EPSV mode for IPv4
- PR-258 nsh: Always try FILE_APPS even if the command is builtin,
this is a regression introduced in 9.0.0
- PR-257 gs2200m: Handle packets over 1500 Bytes, previously would
overflow buffer
- PR-221 gs2200m: Server sockets were not properly being released by
the daemon when close was called
- PR-248 dhcpd: Correct option header check length
- PR-176 cu: Handle NULL character correctly
- PR-287 PR-290 examples: Update nxflat and thttpd Makefile's to fix
a build breakage.

2
arch/z80/src/ez80/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
!*.asm

2
arch/z80/src/z180/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
!*.asm

2
arch/z80/src/z80/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
!*.asm

View file

@ -188,6 +188,10 @@ boards/arm/stm32/axoloti
Support for the Axoloti synthesizer board based on the STMicro Support for the Axoloti synthesizer board based on the STMicro
STM32F427IGH6 MCU. See: http://www.axoloti.com/ STM32F427IGH6 MCU. See: http://www.axoloti.com/
boards/arm/stm32/b-g474e-dpow1
Initial support for booting NuttX to a functional NSH prompt on the
STMicro B-G474E-DPOW1 Discovery kit with STM32G474RE MCU.
boards/arm/stm32f0l0g0/b-l072z-lrwan1 boards/arm/stm32f0l0g0/b-l072z-lrwan1
STMicro STM32L0 Discovery kit with LoRa/SigFox based on STM32L072CZ MCU. STMicro STM32L0 Discovery kit with LoRa/SigFox based on STM32L072CZ MCU.

View file

@ -1 +1,2 @@
/etctmp* /etctmp*
!/etc/**

View file

@ -212,17 +212,6 @@
#define IP_TTL 64 #define IP_TTL 64
#ifdef CONFIG_NET_TCP_REASSEMBLY
# ifndef CONFIG_NET_TCP_REASS_MAXAGE
/* The maximum time an IP fragment should wait in the reassembly
* buffer before it is dropped. Units are deci-seconds, the range
* of the timer is 8-bits.
*/
# define CONFIG_NET_TCP_REASS_MAXAGE (20 * 10) /* 20 seconds */
# endif
#endif
/* Network drivers often receive packets with garbage at the end /* Network drivers often receive packets with garbage at the end
* and are longer than the size of packet in the TCP header. The * and are longer than the size of packet in the TCP header. The
* following "fudge" factor increases the size of the I/O buffering * following "fudge" factor increases the size of the I/O buffering

View file

@ -150,7 +150,7 @@ static void _calc_imm(long offset, long *imm_hi, long *imm_lo)
{ {
hi++; hi++;
} }
else if (r <= -2048) else if (r < -2048)
{ {
hi--; hi--;
} }

View file

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* mm/mm_heap/mm_realloc.c * mm/mm_heap/mm_realloc.c
* *
* Copyright (C) 2007, 2009, 2013-2014, 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2009, 2013-2014, 2017 Gregory Nutt.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -256,7 +256,9 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
next->preceding = newnode->size | next->preceding = newnode->size |
(next->preceding & MM_ALLOC_BIT); (next->preceding & MM_ALLOC_BIT);
/* Return the previous free node to the nodelist (with the new size) */ /* Return the previous free node to the nodelist
* (with the new size)
*/
mm_addfreechunk(heap, prev); mm_addfreechunk(heap, prev);
} }
@ -270,17 +272,17 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
(next->preceding & MM_ALLOC_BIT); (next->preceding & MM_ALLOC_BIT);
} }
/* Now we want to return newnode */
oldnode = newnode;
oldsize = newnode->size;
/* Now we have to move the user contents 'down' in memory. memcpy /* Now we have to move the user contents 'down' in memory. memcpy
* should be safe for this. * should be safe for this.
*/ */
newmem = (FAR void *)((FAR char *)newnode + SIZEOF_MM_ALLOCNODE); newmem = (FAR void *)((FAR char *)newnode + SIZEOF_MM_ALLOCNODE);
memcpy(newmem, oldmem, oldsize - SIZEOF_MM_ALLOCNODE); memcpy(newmem, oldmem, oldsize - SIZEOF_MM_ALLOCNODE);
/* Now we want to return newnode */
oldnode = newnode;
oldsize = newnode->size;
} }
/* Extend into the next free chunk */ /* Extend into the next free chunk */
@ -294,7 +296,8 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
* chunk) * chunk)
*/ */
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + nextsize); andbeyond = (FAR struct mm_allocnode_s *)
((FAR char *)next + nextsize);
/* Remove the next node. There must be a predecessor, but there /* Remove the next node. There must be a predecessor, but there
* may not be a successor node. * may not be a successor node.
@ -311,7 +314,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
oldnode->size = oldsize + takenext; oldnode->size = oldsize + takenext;
newnode = (FAR struct mm_freenode_s *) newnode = (FAR struct mm_freenode_s *)
((FAR char *)oldnode + oldnode->size); ((FAR char *)oldnode + oldnode->size);
/* Did we consume the entire preceding chunk? */ /* Did we consume the entire preceding chunk? */
@ -344,7 +347,9 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
return newmem; return newmem;
} }
/* The current chunk cannot be extended. Just allocate a new chunk and copy */ /* The current chunk cannot be extended.
* Just allocate a new chunk and copy
*/
else else
{ {

View file

@ -284,39 +284,6 @@ config NET_IPv4
---help--- ---help---
Build in support for IPv4. Build in support for IPv4.
config NET_IPv4_REASSEMBLY
bool "IPv4 reassembly"
default n
depends on NET_IPv4 && EXPERIMENTAL && NET_ETHERNET
---help---
Enable support for IP packet reassembly of fragmented IP packets.
This features requires an additional amount of RAM to hold a single
reassembly buffer. The reassembly buffer is of the same size as the
MTU of the selected device.
REVISIT: There are multiple issues with the current implementation:
1. IPv4 reassembly in its current form is untested (and, hence,
depends on CONFIG_EXPERIMENTAL).
2. Currently this feature can only work with Ethernet due to internal
definitions that depend on Ethernet configuration settings (and,
hence, depends on CONFIG_NET_ETHERNET).
3. Since there is only a single reassembly buffer, IPv4 reassembly
cannot be used in a context where multiple network devices may be
concurrently re-assemblying packets.
if NET_IPv4_REASSEMBLY
config NET_IPv4_REASS_MAXAGE
int "IP fragment timeout"
default 200
---help---
The maximum time an IP fragment should wait in the reassembly buffer
before it is dropped. Units are deci-seconds, the range of the timer
is 8-bits. Default: 20 seconds.
endif # NET_IPv4_REASSEMBLY
config NET_IPv6 config NET_IPv6
bool "IPv6" bool "IPv6"
default n default n

View file

@ -274,12 +274,6 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
#ifdef CONFIG_NET_IPv4_REASSEMBLY
/* Reassembly timer (units: deci-seconds) */
EXTERN uint8_t g_reassembly_timer;
#endif
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/

View file

@ -62,12 +62,6 @@
struct net_stats_s g_netstats; struct net_stats_s g_netstats;
#endif #endif
#ifdef CONFIG_NET_IPv4_REASSEMBLY
/* Reassembly timer (units: deci-seconds) */
uint8_t g_reassembly_timer;
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/

View file

@ -770,16 +770,6 @@ int devif_timer(FAR struct net_driver_s *dev, int delay,
#endif #endif
int bstop = false; int bstop = false;
#ifdef CONFIG_NET_IPv4_REASSEMBLY
/* Increment the timer used by the IP reassembly logic */
if (g_reassembly_timer != 0 &&
g_reassembly_timer < CONFIG_NET_IPv4_REASS_MAXAGE)
{
g_reassembly_timer += hsec;
}
#endif
#ifdef NET_TCP_HAVE_STACK #ifdef NET_TCP_HAVE_STACK
/* Traverse all of the active TCP connections and perform the /* Traverse all of the active TCP connections and perform the
* timer action. * timer action.

View file

@ -111,205 +111,15 @@
/* Macros */ /* Macros */
#define BUF ((FAR struct ipv4_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)]) #define BUF ((FAR struct ipv4_hdr_s *)&dev->d_buf[NET_LL_HDRLEN(dev)])
#define FBUF ((FAR struct ipv4_hdr_s *)&g_reassembly_buffer[0])
/* IP fragment re-assembly.
*
* REVISIT: There are multiple issues with the current implementation:
* 1. IPv4 reassembly is untested.
* 2. Currently can only work with Ethernet due to the definition of
* IPv4_REASS_BUFSIZE.
* 3. Since there is only a single reassembly buffer, IPv4 reassembly cannot
* be used in a context where multiple network devices may be concurrently
* re-assembling packets.
*/
#define IP_MF 0x20 /* See IP_FLAG_MOREFRAGS */
#define IPv4_REASS_BUFSIZE (CONFIG_NET_ETH_PKTSIZE - ETH_HDRLEN)
#define IPv4_REASS_LASTFRAG 0x01
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NET_IPv4_REASSEMBLY
static uint8_t g_reassembly_buffer[IPv4_REASS_BUFSIZE];
static uint8_t g_reassembly_bitmap[IPv4_REASS_BUFSIZE / (8 * 8)];
static const uint8_t g_bitmap_bits[8] =
{
0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01
};
static uint16_t g_reassembly_len;
static uint8_t g_reassembly_flags;
#endif /* CONFIG_NET_IPv4_REASSEMBLY */
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: devif_reassembly
*
* Description:
* IP fragment reassembly: not well-tested.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IPv4_REASSEMBLY
static uint8_t devif_reassembly(FAR struct net_driver_s *dev)
{
FAR struct ipv4_hdr_s *ipv4 = BUF;
FAR struct ipv4_hdr_s *fipv4 = FBUF;
uint16_t offset;
uint16_t len;
uint16_t i;
/* If g_reassembly_timer is zero, no packet is present in the buffer, so
* we write the IP header of the fragment into the reassembly buffer. The
* timer is updated with the maximum age.
*/
if (!g_reassembly_timer)
{
memcpy(g_reassembly_buffer, &ipv4->vhl, IPv4_HDRLEN);
g_reassembly_timer = CONFIG_NET_IPv4_REASS_MAXAGE;
g_reassembly_flags = 0;
/* Clear the bitmap. */
memset(g_reassembly_bitmap, 0, sizeof(g_reassembly_bitmap));
}
/* Check if the incoming fragment matches the one currently present
* in the reassembly buffer. If so, we proceed with copying the
* fragment into the buffer.
*/
if (net_ipv4addr_hdrcmp(ipv4->srcipaddr, fipv4->srcipaddr) &&
net_ipv4addr_hdrcmp(ipv4->destipaddr, fipv4->destipaddr) &&
ipv4->ipid[0] == fipv4->ipid[0] && ipv4->ipid[1] == fipv4->ipid[1])
{
len = ((uint16_t)ipv4->len[0] << 8) + (uint16_t)ipv4->len[1] -
(uint16_t)(ipv4->vhl & 0x0f) * 4;
offset = (((ipv4->ipoffset[0] & 0x3f) << 8) + ipv4->ipoffset[1]) * 8;
/* If the offset or the offset + fragment length overflows the
* reassembly buffer, we discard the entire packet.
*/
if (offset > IPv4_REASS_BUFSIZE || offset + len > IPv4_REASS_BUFSIZE)
{
g_reassembly_timer = 0;
goto nullreturn;
}
/* Copy the fragment into the reassembly buffer, at the right offset. */
memcpy(&g_reassembly_buffer[IPv4_HDRLEN + offset],
(FAR char *)ipv4 + (int)((ipv4->vhl & 0x0f) * 4), len);
/* Update the bitmap. */
if (offset / (8 * 8) == (offset + len) / (8 * 8))
{
/* If the two endpoints are in the same byte, we only update that byte. */
g_reassembly_bitmap[offset / (8 * 8)] |=
g_bitmap_bits[(offset / 8) & 7] &
~g_bitmap_bits[((offset + len) / 8) & 7];
}
else
{
/* If the two endpoints are in different bytes, we update the bytes
* in the endpoints and fill the stuff in between with 0xff.
*/
g_reassembly_bitmap[offset / (8 * 8)] |=
g_bitmap_bits[(offset / 8) & 7];
for (i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i)
{
g_reassembly_bitmap[i] = 0xff;
}
g_reassembly_bitmap[(offset + len) / (8 * 8)] |=
~g_bitmap_bits[((offset + len) / 8) & 7];
}
/* If this fragment has the More Fragments flag set to zero, we know that
* this is the last fragment, so we can calculate the size of the entire
* packet. We also set the IP_REASS_FLAG_LASTFRAG flag to indicate that
* we have received the final fragment.
*/
if ((ipv4->ipoffset[0] & IP_MF) == 0)
{
g_reassembly_flags |= IPv4_REASS_LASTFRAG;
g_reassembly_len = offset + len;
}
/* Finally, we check if we have a full packet in the buffer. We do this
* by checking if we have the last fragment and if all bits in the bitmap
* are set.
*/
if (g_reassembly_flags & IPv4_REASS_LASTFRAG)
{
/* Check all bytes up to and including all but the last byte in
* the bitmap.
*/
for (i = 0; i < g_reassembly_len / (8 * 8) - 1; ++i)
{
if (g_reassembly_bitmap[i] != 0xff)
{
goto nullreturn;
}
}
/* Check the last byte in the bitmap. It should contain just the
* right amount of bits.
*/
if (g_reassembly_bitmap[g_reassembly_len / (8 * 8)] !=
(uint8_t)~g_bitmap_bits[g_reassembly_len / 8 & 7])
{
goto nullreturn;
}
/* If we have come this far, we have a full packet in the buffer,
* so we allocate a ipv4 and copy the packet into it. We also reset
* the timer.
*/
g_reassembly_timer = 0;
memcpy(ipv4, fipv4, g_reassembly_len);
/* Pretend to be a "normal" (i.e., not fragmented) IP packet from
* now on.
*/
ipv4->ipoffset[0] = ipv4->ipoffset[1] = 0;
ipv4->len[0] = g_reassembly_len >> 8;
ipv4->len[1] = g_reassembly_len & 0xff;
ipv4->ipchksum = 0;
ipv4->ipchksum = ~(ipv4_chksum(dev));
return g_reassembly_len;
}
}
nullreturn:
return 0;
}
#endif /* CONFIG_NET_IPv4_REASSEMBLY */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -396,18 +206,12 @@ int ipv4_input(FAR struct net_driver_s *dev)
if ((ipv4->ipoffset[0] & 0x3f) != 0 || ipv4->ipoffset[1] != 0) if ((ipv4->ipoffset[0] & 0x3f) != 0 || ipv4->ipoffset[1] != 0)
{ {
#ifdef CONFIG_NET_IPv4_REASSEMBLY
dev->d_len = devif_reassembly(dev);
if (dev->d_len == 0)
#endif
{
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
g_netstats.ipv4.drop++; g_netstats.ipv4.drop++;
g_netstats.ipv4.fragerr++; g_netstats.ipv4.fragerr++;
#endif #endif
nwarn("WARNING: IP fragment dropped\n"); nwarn("WARNING: IP fragment dropped\n");
goto drop; goto drop;
}
} }
/* Get the destination IP address in a friendlier form */ /* Get the destination IP address in a friendlier form */

View file

@ -794,13 +794,13 @@ found:
return; return;
} }
/* Check the URG flag. If this is set, the segment carries urgent #ifdef CONFIG_NET_TCPURGDATA
/* Check the URG flag. If this is set, the segment carries urgent
* data that we must pass to the application. * data that we must pass to the application.
*/ */
if ((tcp->flags & TCP_URG) != 0) if ((tcp->flags & TCP_URG) != 0)
{ {
#ifdef CONFIG_NET_TCPURGDATA
dev->d_urglen = (tcp->urgp[0] << 8) | tcp->urgp[1]; dev->d_urglen = (tcp->urgp[0] << 8) | tcp->urgp[1];
if (dev->d_urglen > dev->d_len) if (dev->d_urglen > dev->d_len)
{ {
@ -809,6 +809,16 @@ found:
dev->d_urglen = dev->d_len; dev->d_urglen = dev->d_len;
} }
/* The d_len field contains the length of the incoming data.
* d_urgdata points to the "urgent" data at the beginning of
* the payload; d_appdata field points to the any "normal" data
* that may follow the urgent data.
*
* NOTE: If the urgent data continues in the next packet, then
* d_len will be zero and d_appdata will point past the end of
* the payload (which is OK).
*/
net_incr32(conn->rcvseq, dev->d_urglen); net_incr32(conn->rcvseq, dev->d_urglen);
dev->d_len -= dev->d_urglen; dev->d_len -= dev->d_urglen;
dev->d_urgdata = dev->d_appdata; dev->d_urgdata = dev->d_appdata;
@ -816,14 +826,41 @@ found:
} }
else else
{ {
/* No urgent data */
dev->d_urglen = 0; dev->d_urglen = 0;
#else /* CONFIG_NET_TCPURGDATA */
dev->d_appdata = ((FAR uint8_t *)dev->d_appdata) +
((tcp->urgp[0] << 8) | tcp->urgp[1]);
dev->d_len -= (tcp->urgp[0] << 8) | tcp->urgp[1];
#endif /* CONFIG_NET_TCPURGDATA */
} }
#else /* CONFIG_NET_TCPURGDATA */
/* Check the URG flag. If this is set, We must gracefully ignore
* and discard the urgent data.
*/
if ((tcp->flags & TCP_URG) != 0)
{
uint16_t urglen = (tcp->urgp[0] << 8) | tcp->urgp[1];
if (urglen > dev->d_len)
{
/* There is more urgent data in the next segment to come. */
urglen = dev->d_len;
}
/* The d_len field contains the length of the incoming data;
* The d_appdata field points to the any "normal" data that
* may follow the urgent data.
*
* NOTE: If the urgent data continues in the next packet, then
* d_len will be zero and d_appdata will point past the end of
* the payload (which is OK).
*/
net_incr32(conn->rcvseq, urglen);
dev->d_len -= urglen;
dev->d_appdata += urglen;
}
#endif /* CONFIG_NET_TCPURGDATA */
#ifdef CONFIG_NET_TCP_KEEPALIVE #ifdef CONFIG_NET_TCP_KEEPALIVE
/* If the established socket receives an ACK or any kind of data /* If the established socket receives an ACK or any kind of data
* from the remote peer (whether we accept it or not), then reset * from the remote peer (whether we accept it or not), then reset

View file

@ -29,7 +29,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Included Files * Included Files
@ -136,7 +136,9 @@ static const unsigned char clefia_s1[256] =
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
static void bytecpy(unsigned char *dst, const unsigned char *src, int bytelen) static void bytecpy(unsigned char *dst,
const unsigned char *src,
int bytelen)
{ {
while (bytelen-- > 0) while (bytelen-- > 0)
{ {

View file

@ -29,7 +29,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ ****************************************************************************/
#ifndef _TOOLS_CXD56_CLEFIA_H_ #ifndef _TOOLS_CXD56_CLEFIA_H_
#define _TOOLS_CXD56_CLEFIA_H_ #define _TOOLS_CXD56_CLEFIA_H_

175
tools/cxd56/elf32.h Normal file
View file

@ -0,0 +1,175 @@
/****************************************************************************
* tools/cxd56/elf32.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Reference: System V Application Binary Interface, Edition 4.1, March 18,
* 1997, The Santa Cruz Operation, Inc.
*
* 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 NuttX 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 __INCLUDE_ELF32_H
#define __INCLUDE_ELF32_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define EI_NIDENT 16 /* Size of e_ident[] */
#define ELF32_ST_BIND(i) ((i) >> 4)
#define ELF32_ST_TYPE(i) ((i) & 0xf)
#define ELF32_ST_INFO(b,t) (((b) << 4) | ((t) & 0xf))
/* Definitions for Elf32_Rel*::r_info */
#define ELF32_R_SYM(i) ((i) >> 8)
#define ELF32_R_TYPE(i) ((i) & 0xff)
#define ELF32_R_INFO(s,t) (((s)<< 8) | ((t) & 0xff))
#define ELF_R_SYM(i) ELF32_R_SYM(i)
/****************************************************************************
* Public Type Definitions
****************************************************************************/
/* Figure 4.2: 32-Bit Data Types */
typedef uint32_t Elf32_Addr; /* Unsigned program address */
typedef uint16_t Elf32_Half; /* Unsigned medium integer */
typedef uint32_t Elf32_Off; /* Unsigned file offset */
typedef int32_t Elf32_Sword; /* Signed large integer */
typedef uint32_t Elf32_Word; /* Unsigned large integer */
/* Figure 4-3: ELF Header */
typedef struct
{
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
Elf32_Word e_version;
Elf32_Addr e_entry;
Elf32_Off e_phoff;
Elf32_Off e_shoff;
Elf32_Word e_flags;
Elf32_Half e_ehsize;
Elf32_Half e_phentsize;
Elf32_Half e_phnum;
Elf32_Half e_shentsize;
Elf32_Half e_shnum;
Elf32_Half e_shstrndx;
} Elf32_Ehdr;
/* Figure 4-8: Section Header */
typedef struct
{
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
} Elf32_Shdr;
/* Figure 4-15: Symbol Table Entry */
typedef struct
{
Elf32_Word st_name;
Elf32_Addr st_value;
Elf32_Word st_size;
unsigned char st_info;
unsigned char st_other;
Elf32_Half st_shndx;
} Elf32_Sym;
/* Figure 4-19: Relocation Entries */
typedef struct
{
Elf32_Addr r_offset;
Elf32_Word r_info;
} Elf32_Rel;
typedef struct
{
Elf32_Addr r_offset;
Elf32_Word r_info;
Elf32_Sword r_addend;
} Elf32_Rela;
/* Figure 5-1: Program Header */
typedef struct
{
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
Elf32_Word p_filesz;
Elf32_Word p_memsz;
Elf32_Word p_flags;
Elf32_Word p_align;
} Elf32_Phdr;
/* Figure 5-9: Dynamic Structure */
typedef struct
{
Elf32_Sword d_tag;
union
{
Elf32_Word d_val;
Elf32_Addr d_ptr;
} d_un;
} Elf32_Dyn;
typedef Elf32_Addr Elf_Addr;
typedef Elf32_Ehdr Elf_Ehdr;
typedef Elf32_Rel Elf_Rel;
typedef Elf32_Rela Elf_Rela;
typedef Elf32_Sym Elf_Sym;
typedef Elf32_Shdr Elf_Shdr;
typedef Elf32_Word Elf_Word;
#endif /* __INCLUDE_ELF32_H */

View file

@ -29,7 +29,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Included Files * Included Files
@ -133,7 +133,7 @@ static struct args *parse_args(int argc, char **argv)
if (show_help == 1) if (show_help == 1)
{ {
fprintf(stderr, fprintf(stderr,
"mkspk [-c <number>] <filename> <save name> [<output file>]\n"); "mkspk [-c <number>] <filename> <save name> [<output file>]\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View file

@ -29,19 +29,29 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include "clefia.h" #include "clefia.h"
#include "elf.h" #include "elf32.h"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define EI_MAG0 0 /* File identification */
#define EI_MAG1 1
#define EI_MAG2 2
#define EI_MAG3 3
#define SHT_SYMTAB 2
#define SHT_STRTAB 3
#define PT_LOAD 1
#define alignup(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) #define alignup(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
#define swap(a, b) { (a) ^= (b); (b) ^= (a); (a) ^= (b); } #define swap(a, b) { (a) ^= (b); (b) ^= (a); (a) ^= (b); }

View file

@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
# #
WD=`pwd` WD=$(dirname $0)
# Get command line parameters # Get command line parameters
@ -86,7 +86,7 @@ done
OUTFILE=$1 OUTFILE=$1
if [ -z ${VERSION} ] ; then if [ -z ${VERSION} ] ; then
VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2` VERSION=`git -C ${WD} tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
# Earlier tags used the format "major.minor", append a "0" for a patch. # Earlier tags used the format "major.minor", append a "0" for a patch.
@ -133,12 +133,12 @@ PATCH=`echo ${VERSION} | cut -d'.' -f3`
# Get GIT information (if not provided on the command line) # Get GIT information (if not provided on the command line)
if [ -z "${BUILD}" ]; then if [ -z "${BUILD}" ]; then
BUILD=`git log --oneline -1 | cut -d' ' -f1 2>/dev/null` BUILD=`git -C ${WD} log --oneline -1 | cut -d' ' -f1 2>/dev/null`
if [ -z "${BUILD}" ]; then if [ -z "${BUILD}" ]; then
echo "GIT version information is not available" echo "GIT version information is not available"
exit 5 exit 5
fi fi
if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then if [ -n "`git -C ${WD} diff-index --name-only HEAD | head -1`" ]; then
BUILD=${BUILD}-dirty BUILD=${BUILD}-dirty
fi fi
fi fi

12
tools/zipme.sh Normal file → Executable file
View file

@ -121,7 +121,7 @@ done
VERSION=$1 VERSION=$1
if [ -n ${VERSION} ] ; then if [ -n ${VERSION} ] ; then
VERSIONOPT="-v ${VERSION}" VERSIONOPT="-v ${VERSION}"
if fi
# Full tar options # Full tar options
@ -129,7 +129,7 @@ for pat in ${EXCLPAT} ; do
TAR+=" --exclude=${pat}" TAR+=" --exclude=${pat}"
done done
TAR+=" --exclude-vcs-ignores --exclude-vcs" TAR+=" --exclude-vcs"
if [ $verbose != 0 ] ; then if [ $verbose != 0 ] ; then
TAR+=" -czvf" TAR+=" -czvf"
@ -184,9 +184,6 @@ fi
# Perform a full clean for the distribution # Perform a full clean for the distribution
cd ${TRUNKDIR} || \
{ echo "Failed to cd to ${TRUNKDIR}" ; exit 1 ; }
echo "Cleaning the repositories" echo "Cleaning the repositories"
if [ $verbose != 0 ] ; then if [ $verbose != 0 ] ; then
@ -197,11 +194,6 @@ fi
# Prepare the nuttx directory # Prepare the nuttx directory
# Make sure that versioned copies of certain files are in place
cd ${NUTTXDIR}/Documentation || \
{ echo "Failed to cd to ${NUTTXDIR}/Documentation" ; exit 1 ; }
# Write a version file into the NuttX directory. The syntax of file is such that it # Write a version file into the NuttX directory. The syntax of file is such that it
# may be sourced by a bash script or included by a Makefile. # may be sourced by a bash script or included by a Makefile.