mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
@@ -224,6 +224,86 @@ Configurations
|
||||
Configuration sub-directories
|
||||
-----------------------------
|
||||
|
||||
knsh:
|
||||
|
||||
This is identical to the nsh configuration below except that NuttX
|
||||
is built as a protected mode, monolithic module and the user applications
|
||||
are built separately.
|
||||
|
||||
It is recommends to use a special make command; not just 'make' but make
|
||||
with the following two arguments:
|
||||
|
||||
make pass1 pass2
|
||||
|
||||
In the normal case (just 'make'), make will attempt to build both user-
|
||||
and kernel-mode blobs more or less interleaved. This actual works!
|
||||
However, for me it is very confusing so I prefer the above make command:
|
||||
Make the user-space binaries first (pass1), then make the kernel-space
|
||||
binaries (pass2)
|
||||
|
||||
NOTES:
|
||||
|
||||
1. At the end of the build, there will be several files in the top-level
|
||||
NuttX build directory:
|
||||
|
||||
PASS1:
|
||||
nuttx_user.elf - The pass1 user-space ELF file
|
||||
nuttx_user.hex - The pass1 Intel HEX format file (selected in defconfig)
|
||||
User.map - Symbols in the user-space ELF file
|
||||
|
||||
PASS2:
|
||||
nuttx - The pass2 kernel-space ELF file
|
||||
nuttx.hex - The pass2 Intel HEX file (selected in defconfig)
|
||||
System.map - Symbols in the kernel-space ELF file
|
||||
|
||||
The J-Link programmer will accept files in .hex, .mot, .srec, and .bin
|
||||
formats. The St-Link programmer will accept files in hex and .bin
|
||||
formats.
|
||||
|
||||
2. Combining .hex files. If you plan to use the .hex files with your
|
||||
debugger or FLASH utility, then you may need to combine the two hex
|
||||
files into a single .hex file. Here is how you can do that.
|
||||
|
||||
a. The 'tail' of the nuttx.hex file should look something like this
|
||||
(with my comments added):
|
||||
|
||||
$ tail nuttx.hex
|
||||
# 00, data records
|
||||
...
|
||||
:10 9DC0 00 01000000000800006400020100001F0004
|
||||
:10 9DD0 00 3B005A0078009700B500D400F300110151
|
||||
:08 9DE0 00 30014E016D0100008D
|
||||
# 05, Start Linear Address Record
|
||||
:04 0000 05 0800 0419 D2
|
||||
# 01, End Of File record
|
||||
:00 0000 01 FF
|
||||
|
||||
Use an editor such as vi to remove the 05 and 01 records.
|
||||
|
||||
b. The 'head' of the nuttx_user.hex file should look something like
|
||||
this (again with my comments added):
|
||||
|
||||
$ head nuttx_user.hex
|
||||
# 04, Extended Linear Address Record
|
||||
:02 0000 04 0801 F1
|
||||
# 00, data records
|
||||
:10 8000 00 BD89 01084C800108C8110208D01102087E
|
||||
:10 8010 00 0010 00201C1000201C1000203C16002026
|
||||
:10 8020 00 4D80 01085D80010869800108ED83010829
|
||||
...
|
||||
|
||||
Nothing needs to be done here. The nuttx_user.hex file should
|
||||
be fine.
|
||||
|
||||
c. Combine the edited nuttx.hex and un-edited nuttx_user.hex
|
||||
file to produce a single combined hex file:
|
||||
|
||||
$ cat nuttx.hex nuttx_user.hex >combined.hex
|
||||
|
||||
Then use the combined.hex file with the to write the FLASH image.
|
||||
If you do this a lot, you will probably want to invest a little time
|
||||
to develop a tool to automate these steps.
|
||||
|
||||
mrf24j40-radio
|
||||
|
||||
This is a version of nsh that was used for testing the MRF24J40 be as a
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
############################################################################
|
||||
# configs/clicker2-stm32/knsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
LDSCRIPT = flash.ld
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
# Loadable module definitions
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,32 +17,16 @@ Contents
|
||||
|
||||
Status
|
||||
======
|
||||
2017-04-27: There are many problems. On start up, I have to reset
|
||||
several times before I get NSH prompt (or parts of it). Apparently the
|
||||
STM32 is either hanging (perhaps in clockconfig()) or perhaps it has
|
||||
taken a hard fault before it is able to generate debug output?
|
||||
2017-04-28: After struggling with some clock configuration and FLASH wait
|
||||
state issues, the board now boots and the basic NSH configurations works
|
||||
without problem.
|
||||
|
||||
There are many hardfaults during initial serial output. This change
|
||||
seems to eliminate those hardfaults:
|
||||
A USB device driver was added along with support for clocking from the
|
||||
HSI48. That driver remains untested.
|
||||
|
||||
@@ -2163,7 +2163,7 @@ static void stm32f0serial_txint(FAR struct uart_dev_s *dev, bool enable)
|
||||
* interrupts disabled (note this may recurse).
|
||||
*/
|
||||
|
||||
- uart_xmitchars(dev);
|
||||
+// uart_xmitchars(dev);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
||||
Which implies that the hardfaults are due to runaway recursion in the
|
||||
serial driver? This suggest some error in either determining when there
|
||||
is TX data available or in disabling TX interrupts.
|
||||
|
||||
But this not a solution. Even without the hard faults, it may hang
|
||||
attempting to output the NSH greeting and prompt or hang unable to
|
||||
receive input. These symptoms suggest some issue with TX and RX
|
||||
interrupt handling.
|
||||
2017-04-30: I tried using the I2C driver with the I2C tool (apps/system/i2c).
|
||||
I may have something wrong, but at present the driver is just timing out
|
||||
on all transfers.
|
||||
|
||||
Nucleo-64 Boards
|
||||
================
|
||||
@@ -155,6 +139,8 @@ Serial Console
|
||||
PA14
|
||||
PD5
|
||||
|
||||
See "Virtual COM Port" and "RS-232 Shield" below.
|
||||
|
||||
USART3
|
||||
------
|
||||
Pins and Connectors:
|
||||
@@ -168,8 +154,6 @@ Serial Console
|
||||
PC10
|
||||
D8
|
||||
|
||||
See "Virtual COM Port" and "RS-232 Shield" below.
|
||||
|
||||
USART3
|
||||
------
|
||||
Pins and Connectors:
|
||||
@@ -197,8 +181,8 @@ Serial Console
|
||||
|
||||
Configuring USART2 is the same as given above.
|
||||
|
||||
Question: What BAUD should be configure to interface with the Virtual
|
||||
COM port? 115200 8N1?
|
||||
115200 8N1 BAUD should be configure to interface with the Virtual COM
|
||||
port.
|
||||
|
||||
Default
|
||||
-------
|
||||
|
||||
@@ -230,12 +230,19 @@
|
||||
/* Alternate Pin Functions **********************************************************/
|
||||
/* USART 1 */
|
||||
|
||||
#define GPIO_USART1_TX GPIO_USART1_TX_2
|
||||
#define GPIO_USART1_RX GPIO_USART1_RX_2
|
||||
#define GPIO_USART1_TX GPIO_USART1_TX_2 /* PA9 CN10 pin 21 */
|
||||
#define GPIO_USART1_RX GPIO_USART1_RX_2 /* PA10 CN10 pin 33 */
|
||||
|
||||
/* USART 2 */
|
||||
|
||||
#define GPIO_USART2_TX GPIO_USART2_TX_3
|
||||
#define GPIO_USART2_RX GPIO_USART2_RX_3
|
||||
#define GPIO_USART2_TX GPIO_USART2_TX_3 /* PA2 St-Link VCOM */
|
||||
#define GPIO_USART2_RX GPIO_USART2_RX_3 /* PA3 St-Link VCOM */
|
||||
|
||||
/* I2C1 */
|
||||
|
||||
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_2 /* PB8 CN5 pin 10, D15 */
|
||||
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_2 /* PB9 CN5 pin 9, D14 */
|
||||
|
||||
/* I2C2 */
|
||||
|
||||
#endif /* __CONFIG_NUCLEO_F072RB_INCLUDE_BOARD_H */
|
||||
|
||||
@@ -43,8 +43,20 @@
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
#include "stm32f0_i2c.h"
|
||||
#include "nucleo-f072rb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Defintiionis
|
||||
****************************************************************************/
|
||||
|
||||
#undef HAVE_I2C_DRIVER
|
||||
#if defined(CONFIG_STM32F0_I2C1) && defined(CONFIG_I2C_DRIVER)
|
||||
# define HAVE_I2C_DRIVER 1
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -65,6 +77,9 @@
|
||||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
#ifdef HAVE_I2C_DRIVER
|
||||
FAR struct i2c_master_s *i2c;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
@@ -77,6 +92,26 @@ int stm32_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_I2C_DRIVER
|
||||
/* Get the I2C lower half instance */
|
||||
|
||||
i2c = stm32f0_i2cbus_initialize(1);
|
||||
if (i2c == NULL)
|
||||
{
|
||||
i2cerr("ERROR: Inialize I2C1: %d\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Regiser the I2C character driver */
|
||||
|
||||
ret = i2c_register(i2c, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
i2cerr("ERROR: Failed to register I2C1 device: %d\n", ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -239,4 +239,9 @@
|
||||
#define GPIO_USART1_TX GPIO_USART1_TX_1
|
||||
#define GPIO_USART1_RX GPIO_USART1_RX_1
|
||||
|
||||
/* I2C pins definition */
|
||||
|
||||
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
|
||||
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_1
|
||||
|
||||
#endif /* __CONFIG_STM32F0DISCOVERY_INCLUDE_BOARD_H */
|
||||
|
||||
Reference in New Issue
Block a user