Skip to content
Snippets Groups Projects
Commit ef79ca3b authored by minute's avatar minute
Browse files

WIP add reform2-lpc-fw based on microbuilder

parent b5ec1ddf
Branches reform2-nitrogen8m
No related tags found
No related merge requests found
Showing
with 14868 additions and 0 deletions
......@@ -16,4 +16,5 @@ build
_autosave*
.DS_Store
a.out
bin
This diff is collapsed.
bin
*.o
tests_host
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LPC11U_LPC13U_Codebase</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/LPC11U_LPC13U_Codebase/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<filteredResources>
<filter>
<id>1352877696259</id>
<name>src/drivers/rf/bluetooth/nrf8001</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-data_queue.*</arguments>
</matcher>
</filter>
<filter>
<id>1352877696283</id>
<name>src/drivers/rf/bluetooth/nrf8001</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-hid_application.*</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
language: c
compiler:
- gcc
script: cd tests_host/ && rake test:all
\ No newline at end of file
Software License Agreement (BSD License)
Unless otherwise noted, Copyright (c) 2013 Kevin Townsend (microBuilder.eu)
All rights reserved.
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 of the copyright holders 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 ''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 HOLDER 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.
\ No newline at end of file
##########################################################################
# User configuration and firmware specific object files
##########################################################################
FILENAME=firmware
# See projectconfig.h for a list of valid BOARD options!
BOARD=CFG_BRD_REFORM2
# Set TARGET to 'lpc11u' or 'lpc13u' depending on the target MCU
TARGET = lpc11u
ifeq (lpc11u,$(TARGET))
CORE = cortex-m0
LDSCRIPT = cmsis/lpc11u24.ld
# LDSCRIPT = cmsis/lpc11u37.ld
else
CORE = cortex-m3
LDSCRIPT = cmsis/lpc1347.ld
endif
# Set OPTIMIZATION to '0', '1', '2', '3' or 's'
OPTIMIZATION = s
##########################################################################
# Output directories
##########################################################################
BIN_PATH = bin
OBJ_PATH = bin/obj
##########################################################################
# Source Files
##########################################################################
VPATH = cmsis
ifeq (lpc11u,$(TARGET))
OBJS = $(OBJ_PATH)/startup_lpc11u_gnumake.o
OBJS += $(OBJ_PATH)/system_LPC11Uxx.o
else
OBJS = $(OBJ_PATH)/startup_lpc13u_gnumake.o
OBJS += $(OBJ_PATH)/system_LPC13Uxx.o
endif
OBJS += $(OBJ_PATH)/math_helper.o
OBJS += $(OBJ_PATH)/RTX_hook.o
VPATH += src
OBJS += $(OBJ_PATH)/printf-retarget.o
VPATH += src/boards/lpcnfc
OBJS += $(OBJ_PATH)/board_lpcnfc.o
VPATH += src/boards/reform2
OBJS += $(OBJ_PATH)/board_reform2.o
VPATH += src/boards/rf1ghzusb
OBJS += $(OBJ_PATH)/board_rf1ghzusb.o
VPATH += src/boards/rf1ghznode
OBJS += $(OBJ_PATH)/board_rf1ghznode.o
VPATH += src/cli
OBJS += $(OBJ_PATH)/cli.o
OBJS += $(OBJ_PATH)/commands.o
VPATH += src/cli/commands
OBJS += $(OBJ_PATH)/cmd_chibi_addr.o
OBJS += $(OBJ_PATH)/cmd_chibi_tx.o
OBJS += $(OBJ_PATH)/cmd_dbg_memrd.o
OBJS += $(OBJ_PATH)/cmd_eeprom_read.o
OBJS += $(OBJ_PATH)/cmd_eeprom_write.o
OBJS += $(OBJ_PATH)/cmd_i2c_read.o
OBJS += $(OBJ_PATH)/cmd_i2c_scan.o
OBJS += $(OBJ_PATH)/cmd_i2c_write.o
OBJS += $(OBJ_PATH)/cmd_nfc_mfc_ndef.o
OBJS += $(OBJ_PATH)/cmd_nfc_mifareclassic_memdump.o
OBJS += $(OBJ_PATH)/cmd_nfc_mifareclassic_valueblock.o
OBJS += $(OBJ_PATH)/cmd_nfc_mifareultralight_memdump.o
OBJS += $(OBJ_PATH)/cmd_rtc_read.o
OBJS += $(OBJ_PATH)/cmd_rtc_write.o
OBJS += $(OBJ_PATH)/cmd_sd_dir.o
OBJS += $(OBJ_PATH)/cmd_sysinfo.o
OBJS += $(OBJ_PATH)/cmd_wifi.o
VPATH += src/core/adc
OBJS += $(OBJ_PATH)/adc.o
VPATH += src/core/delay
OBJS += $(OBJ_PATH)/delay.o
VPATH += src/core/debug
OBJS += $(OBJ_PATH)/debug.o
VPATH += src/core/eeprom
OBJS += $(OBJ_PATH)/eeprom.o
VPATH += src/core/fifo
OBJS += $(OBJ_PATH)/fifo.o
VPATH += src/core/gpio
OBJS += $(OBJ_PATH)/gpio.o
VPATH += src/core/i2c
OBJS += $(OBJ_PATH)/i2c.o
VPATH += src/core/iap
OBJS += $(OBJ_PATH)/iap.o
VPATH += src/core/libc
OBJS += $(OBJ_PATH)/stdio.o
OBJS += $(OBJ_PATH)/string.o
VPATH += src/core/pmu
OBJS += $(OBJ_PATH)/pmu.o
VPATH += src/core/ssp0
OBJS += $(OBJ_PATH)/ssp0.o
VPATH += src/core/ssp1
OBJS += $(OBJ_PATH)/ssp1.o
VPATH += src/core/timer16
OBJS += $(OBJ_PATH)/timer16.o
VPATH += src/core/timer32
OBJS += $(OBJ_PATH)/timer32.o
VPATH += src/core/uart
OBJS += $(OBJ_PATH)/uart.o
OBJS += $(OBJ_PATH)/uart_buf.o
VPATH += src/core/usb
OBJS += $(OBJ_PATH)/descriptors.o
OBJS += $(OBJ_PATH)/usb_cdc.o
OBJS += $(OBJ_PATH)/usb_custom_class.o
OBJS += $(OBJ_PATH)/usb_hid.o
OBJS += $(OBJ_PATH)/usb_msc.o
OBJS += $(OBJ_PATH)/usbd.o
VPATH += src/drivers
OBJS += $(OBJ_PATH)/timespan.o
VPATH += src/drivers/displays
OBJS += $(OBJ_PATH)/smallfonts.o
VPATH += src/drivers/displays/bitmap/ssd1306
OBJS += $(OBJ_PATH)/ssd1306_i2c.o
VPATH += src/drivers/displays/graphic
OBJS += $(OBJ_PATH)/aafonts.o
OBJS += $(OBJ_PATH)/colors.o
OBJS += $(OBJ_PATH)/drawing.o
OBJS += $(OBJ_PATH)/fonts.o
OBJS += $(OBJ_PATH)/theme.o
VPATH += src/drivers/displays/graphic/aafonts/aa2
OBJS += $(OBJ_PATH)/DejaVuSansCondensed14_AA2.o
OBJS += $(OBJ_PATH)/DejaVuSansCondensedBold14_AA2.o
OBJS += $(OBJ_PATH)/DejaVuSansMono10_AA2.o
OBJS += $(OBJ_PATH)/DejaVuSansMono13_AA2.o
OBJS += $(OBJ_PATH)/DejaVuSansMono14_AA2.o
OBJS += $(OBJ_PATH)/FontCalibri18_AA2.o
OBJS += $(OBJ_PATH)/FontCalibriBold18_AA2.o
OBJS += $(OBJ_PATH)/FontCalibriItalic18_AA2.o
OBJS += $(OBJ_PATH)/FontFranklinGothicBold99_Numbers_AA2.o
VPATH += src/drivers/displays/graphic/aafonts/aa4
OBJS += $(OBJ_PATH)/FontCalibri18_AA4.o
VPATH += src/drivers/displays/graphic/fonts
OBJS += $(OBJ_PATH)/dejavusans9.o
OBJS += $(OBJ_PATH)/dejavusansbold9.o
OBJS += $(OBJ_PATH)/dejavusanscondensed9.o
OBJS += $(OBJ_PATH)/dejavusansmono8.o
OBJS += $(OBJ_PATH)/dejavusansmonobold8.o
OBJS += $(OBJ_PATH)/veramono9.o
OBJS += $(OBJ_PATH)/veramono11.o
OBJS += $(OBJ_PATH)/veramonobold9.o
OBJS += $(OBJ_PATH)/veramonobold11.o
OBJS += $(OBJ_PATH)/verdana9.o
OBJS += $(OBJ_PATH)/verdana14.o
OBJS += $(OBJ_PATH)/verdanabold14.o
VPATH += src/drivers/displays/graphic/hw
OBJS += $(OBJ_PATH)/hx8340b.o
# OBJS += $(OBJ_PATH)/hx8347g.o
VPATH += src/drivers/displays/segment/ht16k33
OBJS += $(OBJ_PATH)/ht16k33.o
VPATH += src/drivers/filters/iir
OBJS += $(OBJ_PATH)/iir_f.o
OBJS += $(OBJ_PATH)/iir_i.o
OBJS += $(OBJ_PATH)/iir_u16.o
VPATH += src/drivers/filters/ma
OBJS += $(OBJ_PATH)/sma_f.o
OBJS += $(OBJ_PATH)/sma_i.o
OBJS += $(OBJ_PATH)/sma_u16.o
OBJS += $(OBJ_PATH)/wma_f.o
OBJS += $(OBJ_PATH)/wma_i.o
OBJS += $(OBJ_PATH)/wma_u16.o
VPATH += src/drivers/motor/stepper
OBJS += $(OBJ_PATH)/stepper.o
VPATH += src/drivers/pwm/pca9685
OBJS += $(OBJ_PATH)/pca9685.o
VPATH += src/drivers/rf/802.15.4/chibi
OBJS += $(OBJ_PATH)/chb.o
OBJS += $(OBJ_PATH)/chb_buf.o
OBJS += $(OBJ_PATH)/chb_drvr.o
OBJS += $(OBJ_PATH)/chb_eeprom.o
OBJS += $(OBJ_PATH)/chb_spi.o
OBJS += $(OBJ_PATH)/messages.o
VPATH += src/drivers/rf/nfc/pn532
OBJS += $(OBJ_PATH)/pn532.o
OBJS += $(OBJ_PATH)/pn532_bus_i2c.o
OBJS += $(OBJ_PATH)/pn532_bus_uart.o
VPATH += src/drivers/rf/nfc/pn532/helpers
OBJS += $(OBJ_PATH)/pn532_config.o
OBJS += $(OBJ_PATH)/pn532_gpio.o
OBJS += $(OBJ_PATH)/pn532_mifare_classic.o
OBJS += $(OBJ_PATH)/pn532_mifare_ultralight.o
OBJS += $(OBJ_PATH)/pn532_ndef.o
OBJS += $(OBJ_PATH)/pn532_ndef_cards.o
VPATH += src/drivers/rf/wifi/cc3000
OBJS += $(OBJ_PATH)/spi.o
OBJS += $(OBJ_PATH)/wifi.o
VPATH += src/drivers/rf/wifi/cc3000/hostdriver
OBJS += $(OBJ_PATH)/cc3000_common.o
OBJS += $(OBJ_PATH)/evnt_handler.o
OBJS += $(OBJ_PATH)/hci.o
OBJS += $(OBJ_PATH)/netapp.o
OBJS += $(OBJ_PATH)/nvmem.o
OBJS += $(OBJ_PATH)/security.o
OBJS += $(OBJ_PATH)/socket.o
OBJS += $(OBJ_PATH)/wlan.o
VPATH += src/drivers/rf/nfc/pn532/mem_allocator
OBJS += $(OBJ_PATH)/bget.o
OBJS += $(OBJ_PATH)/pn532_mem.o
VPATH += src/drivers/rtc
OBJS += $(OBJ_PATH)/rtc.o
VPATH += src/drivers/rtc/pcf2129
OBJS += $(OBJ_PATH)/pcf2129.o
VPATH += src/drivers/sensors
OBJS += $(OBJ_PATH)/sensors.o
OBJS += $(OBJ_PATH)/sensorpoll.o
VPATH += src/drivers/sensors/accelerometers
OBJS += $(OBJ_PATH)/accelerometers.o
OBJS += $(OBJ_PATH)/adxl345.o
OBJS += $(OBJ_PATH)/lis3dh.o
OBJS += $(OBJ_PATH)/lsm303accel.o
VPATH += src/drivers/sensors/gyroscopes
OBJS += $(OBJ_PATH)/l3gd20.o
VPATH += src/drivers/sensors/light
OBJS += $(OBJ_PATH)/tsl2561.o
VPATH += src/drivers/sensors/magnetometers
OBJS += $(OBJ_PATH)/magnetometers.o
OBJS += $(OBJ_PATH)/lsm303mag.o
VPATH += src/drivers/sensors/pressure
OBJS += $(OBJ_PATH)/pressure.o
OBJS += $(OBJ_PATH)/bmp085.o
OBJS += $(OBJ_PATH)/mpl115a2.o
VPATH += src/drivers/sensors/temperature
OBJS += $(OBJ_PATH)/lm75b.o
VPATH += src/drivers/storage
OBJS += $(OBJ_PATH)/logger.o
VPATH += src/drivers/storage/fatfs
OBJS += $(OBJ_PATH)/ff.o
OBJS += $(OBJ_PATH)/mmc.o
VPATH += src/localisation
OBJS += $(OBJ_PATH)/localisation.o
VPATH += src/protocol
OBJS += $(OBJ_PATH)/protocol.o
VPATH += src/protocol/commands
OBJS += $(OBJ_PATH)/protocol_cmd_led.o
OBJS += $(OBJ_PATH)/protocol_cmd_sysinfo.o
##########################################################################
# Include paths
##########################################################################
ROOT_PATH = src
INCLUDE_PATHS = -I$(ROOT_PATH) -Icmsis
##########################################################################
# GNU GCC compiler prefix
##########################################################################
# Use the default toolchain (based on the PATH variable, etc.)
CROSS_COMPILE ?= arm-none-eabi-
# OR ... use a toolchain at a specific location
# CROSS_COMPILE = C:/code_red/RedSuiteNXP_5.0.12_1048/redsuite/tools/bin/arm-none-eabi-
# CROSS_COMPILE = C:/arm/gnu4.7.2012.q4/bin/arm-none-eabi-
AS = $(CROSS_COMPILE)gcc
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
OUTFILE = $(BIN_PATH)/$(FILENAME)
LPCRC ?= tools/lpcrc/lpcrc
REMOVE = rm -f
MOUNT_POINT ?= /media/CRP DISABLD
##########################################################################
# Compiler settings, parameters and flags
##########################################################################
# Compiler Options
GCFLAGS = -c
GCFLAGS += -std=gnu99
GCFLAGS += -g
GCFLAGS += -O$(OPTIMIZATION)
GCFLAGS += $(INCLUDE_PATHS)
GCFLAGS += -Wall
GCFLAGS += -mthumb
GCFLAGS += -ffunction-sections
GCFLAGS += -fdata-sections
GCFLAGS += -fmessage-length=0
GCFLAGS += -fno-builtin
GCFLAGS += -mcpu=$(CORE)
GCFLAGS += -DTARGET=$(TARGET)
GCFLAGS += -D$(BOARD)
# CMSIS DSP Flags
ifeq (lpc11u,$(TARGET))
GCFLAGS += -DARM_MATH_CM0
else
GCFLAGS += -DARM_MATH_CM3
endif
# For use with the GCC ARM Embedded toolchain
# GCFLAGS += --specs=nano.specs
# For use with the LPCXpresso toolchain
# GCFLAGS += -D__REDLIB__ -D__CODE_RED
# Assembler Options
ASFLAGS = -c
ASFLAGS += -g
ASFLAGS += -O$(OPTIMIZATION)
ASFLAGS += $(INCLUDE_PATHS)
ASFLAGS += -Wall
ASFLAGS += -mthumb
ASFLAGS += -ffunction-sections
ASFLAGS += -fdata-sections
ASFLAGS += -fmessage-length=0
ASFLAGS += -mcpu=$(CORE)
ASFLAGS += -D__ASSEMBLY__
ASFLAGS += -x assembler-with-cpp
# Linker Options
LDFLAGS = -nostartfiles
LDFLAGS += -mcpu=$(CORE)
LDFLAGS += -mthumb
LDFLAGS += -O$(OPTIMIZATION)
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -T $(LDSCRIPT)
LDFLAGS += -Xlinker -Map=bin/firmware.map
# CMSIS Libraries
LDFLAGS += -L./cmsis/libs
ifeq (lpc11u,$(TARGET))
LDLIBS = -larm_cortexM0l_math -lRTX_CM0
else
LDLIBS = -larm_cortexM3l_math -lRTX_CM3
endif
# External Libraries
LDLIBS += -lm
# The following libraries are required with the LPCXpresso toolchain
# LDLIBS += -lcr_c -lcr_eabihelpers
OCFLAGS = --strip-unneeded
##########################################################################
# Rules
##########################################################################
all: firmware
$(OBJ_PATH)/%.o : %.c
@mkdir -p $(dir $@)
-@echo "COMPILING $(@F)"
@$(CC) $(GCFLAGS) -o $@ $<
$(OBJ_PATH)/%.o : %.s
@mkdir -p $(dir $@)
-@echo "ASSEMBLING $(@F)"
@$(AS) $(ASFLAGS) -o $@ $<
firmware: $(OBJS) $(SYS_OBJS)
@mkdir -p $(BIN_PATH)
-@echo ""
-@echo "LINKING $(OUTFILE).elf ($(CORE) -O$(OPTIMIZATION) $(BOARD))"
@$(LD) $(LDFLAGS) -o $(OUTFILE).elf $(LDLIBS) $(OBJS) $(LDLIBS)
-@echo ""
@$(SIZE) $(OUTFILE).elf
-@echo ""
-@echo "Generating $(OUTFILE).hex"
@$(OBJCOPY) $(OCFLAGS) -O ihex $(OUTFILE).elf $(OUTFILE).hex
-@echo "Generating $(OUTFILE).bin"
@$(OBJCOPY) $(OCFLAGS) -O binary $(OUTFILE).elf $(OUTFILE).bin
-@echo ""
@$(LPCRC) $(OUTFILE).bin
flash: firmware
-@echo ""
-@echo "Flashing device ..."
-@[ -e "$(MOUNT_POINT)/firmware.bin" ] && dd if=bin/firmware.bin of="$(MOUNT_POINT)/firmware.bin" conv=nocreat,notrunc && umount "$(MOUNT_POINT)" || echo "Error, no device?!"
lpcrc:
-@echo ""
-@echo "Building lpcrc (checksum tool) ..."
@make -C tools/lpcrc
clean:
@$(REMOVE) $(OBJS) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
#########################################################################
# LPC11U/LPC13U Code Base #
This code base is an attempt at providing a reasonably well-organized, open-source starting point for projects based on the LPC11Uxx and LPC13Uxx family of MCUs.
## Key Features ##
It includes the following key features, which can be easily enabled or disabled via a single board-specific config file:
- [USB CDC, HID and MSC support](https://github.com/microbuilder/LPC11U_LPC13U_Codebase/tree/master/src/core/usb), including HID Keyboard and HID Mouse emulation, with any combination of devices possible up to the number of end points available on the MCU
- Easy to extend [command-line interface](https://github.com/microbuilder/LPC11U_LPC13U_Codebase/tree/master/src/cli) (CLI) with USB CDC and UART support
- [Sensor abstraction layer](https://github.com/microbuilder/LPC11U_LPC13U_Codebase/tree/master/src/drivers/sensors) where all sensors return a common descriptor and data type using standardized SI units
- Basic [localisation support](https://github.com/microbuilder/LPC11U_LPC13U_Codebase/tree/master/src/localisation), allowing multiple languages to be used in the same application
- Graphics sub-system including support for multiple font types (bitmap or anti-aliased), basic drawing functions, and a simple HW abstraction mechanism
- FAT16/32 file system support for SD cards including the option to use long names (via FatFS)
- Numerous wireless stacks, including NFC (based on the PN532) and 802.15.4 (based on the AT86RF212).
- A basic [unit testing framework](https://github.com/microbuilder/LPC11U_LPC13U_Codebase/tree/master/tests_host) suitable for embedded systems (Unity)
## Supported MCUs ##
This code base is designed to work transparently with the following MCUs, allowing you to select the MCU with the right price/performance/size ratio for your project without having to rewrite any underlying code:
- **LPC1347** - ARM Cortex M3, 72MHz, 64KB Flash, 8+2+2KB SRAM, 4KB EEPROM
- **LPC11U37** - ARM Cortex M0, 50MHz, 128KB Flash, 8+2KB SRAM, 4KB EEPROM
- **LPC11U24** - ARM Cortex M0, 50MHa, 32KB Flash, 8+2KB SRAM, 4KB EEPROM
## Multiple Board Support ##
In an attempt to make the code base relevant in a variety of situations, there is a basic [board abstraction layer](https://github.com/microbuilder/LPC11U_LPC13U_Codebase/tree/master/src/boards), and all config settings are board-specific.
The target board in indicated in the shared **projectconfig.h** file, which in turn references the board-specific config and initialization code in the **'boards/'** subfolder.
## Supported IDEs/Toolchains ##
The code base contains a few dependencies on GCC extensions (notably in the localisation system), and has not been tested with any non-GCC toolchain.
At the moment the following IDEs are supported by the code base, and this list may be extended in the future:
**GCC/Makefile ('Makefile')**
The codebase includes startup code, linker scripts and a makefile to build this codebase with the cross-platform, open-source GNU/GCC toolset. This gives you the most control over how your project is built, and allows you to build your project on any platform with support for GCC and make (*NIX, Mac OSX, Windows, etc.). [(more)](doc/toolchain_make.md)
**LPCXpresso / Code Red IDE (.cproject/.project)**
LPCXpresso is a free of charge Eclipse-based IDE based around GCC. It's based on Code Red's commercial Red Suite IDE, but is provided free of charge by NXP Semiconductors with a debug limit up to 128Kb (you can, however, compile projects larger than this), which is within the limits of all of the chips supported by this code base.
Inexpensive LPCXpresso development boards are available with integrated SWD debuggers that can be seperated from the MCU part of the board and used to debug any supported MCU or device. [(more)](doc/toolchain_lpcxpresso.md)
**Crossworks for ARM (CW\_*.hzp)**
Project files are also provided for Rowley Associate's popular Crossworks for ARM IDE, which is GCC based, includes an optimised standard C library, and supports a large variety of HW debuggers (including the popular J-Link from Segger). [(more)](doc/toolchain_crossworks.md)
## Current Development Status ##
This code base is still in active development, and there are almost certainly a number of improvements that can be made to it, bugs that will need to be worked out, and pieces of code that could be better organized or rewritten entirely.
The current localisation system is quite unsatisfactory, for example, but the decision was made to keep in in the code base in the hopes that other people will propose improvements to it, as well as to other parts of this code base.
Until an initial public release is made (version 1.0), the code base should be considered unstable and some reorganisation will almost certainly continue to take place in different parts of the code.
The current code has a good overall structure, but there are still many parts that can be streamlined or reorganized (for example, reworking the UART buffer to use src/core/fifo.c instead of the older buffer from a previous code base).
## How Can I Help? ##
Quite a bit of time, effort and money has gone into producing this open source code base in the sole hope that it will make things easier for other people to get started with this well-rounded MCU family. If you find the code base useful as is, the best thanks you can give is to contribute something useful back to it, and improve the current code base so that other people can learn from your efforts as well.
## License ##
Where possible, all code is provided under a BSD style license, but each file is individually licensed and you should ensure that you fully understand the license terms and limitations of any files you use in your project.
# LPC11U/LPC13U Code Base - Revision History #
Major changes in the LPC11U/LPC13U code base by code base version number.
## 0.9.1 [12 July 2013] ##
- Fixed .bss placement in USB SRAM in linker scripts! (oops!)
## 0.9.0 [12 July 2013] ##
- delay.c interrupt priority changed to be one higher than the lowest level so that other interrupts can potentially be configured to use delay by setting them to the lowest level
- sensorpoll.c added to poll sensor data at fixed intervals using 16-bit timer 1 (though care needs to be taken using this!)
- Disabled both generic interrupt handlers in timer16.c since they are both potentially used elsewhere
- magnetometer.c, accelerometer.c and pressure.c generic helper functions added in the sensor abstraction layer
- Added debug.c to help with debugging in the field
- Merged CMSIS-RTOS (RTX) updates from RTX branch ... basic test works on M3 and M0, but further testing needed
- Added basic USB custom class support (fast bulk transfers)
- USB HID now shares the same API as USB custom class calls to make it easier to switch
- Various improvements to the simple binary protocol
- Removed unity tests (/tests) to make room for ceedling native tests (/tests_host)
- Removed Keil project files since it's too much of a headache to maintain
- Reorganised errors.h (certains numeric values were changed)
- Updated board config files for USB/Protocol additions
- Added CFG\_ENABLE\_TIMER32 to disable TIMER32 (interrupt handlers use a lot of flash/SRAM)
- CC3000 support added (experimental, see note below!)
- Added sysinfo command to the simple binary protocol
- Fixed a bug in iap.c (truncated serial numbers)
- **BREAKING CHANGE**: Moved all /src/drivers/rf code to technology-specific folders ('nfc', 'wifi', etc.)
- **KNOWN ISSUE**: There's a truckload of issues with the CC3000 API from TI! It can't currently be built using the makefile, and is CW only at the moment. Be sure to disable CFG_CC3000 in our board config file until these issues can all be resolved!
- **KNOWN ISSUE**: CFG\_USB\_CUSTOM\_CLASS can not be combined with any HID classes, and you must use one or the other. This seems to be an issue with the ROM drivers and memory managed, and placing the USB memory buffer in the main 8KB block (instead of the 2KB USB SRAM block) avoids this issue, but since the buffer needs to be aligned on a 2048 byte boundary this leads to a huge waste of memory. Investigation ongoing, but for now avoid combining CFG\_USB\_CUSTOM\_CLASS and any HID class(es).
## 0.8.6 [14 June 2013] ##
- Added core/timer16
- Added core/delay (abstraction layer to use systick or timer16[0] for 1ms delays)
- Removed core/systick and changed all systick* calls to delay* (for RTOS compatability)
- Added flow control to uart.c
- Added faster simple moving average filter (drivers/filters/ma/sma\_*), removed old versions
- Added weighted moving average filter (/drivers/filters/ma/wma\_*)
- Renamed CMSIS startup_* files to be clearer
- Added drivers/storage/logger.c to log data to an SD card or a local file (local file is Crossworks only)
- Updated adc.c for differences between LPC11U and LPC1347
- Moved low power and 10-bit ADC mode settings to board config file
- Added custom M3 RTX library (canned M3 RTX lib from ARM generated hardfault)
- Added %f (float), %e (scientific notation) and %E (engineering notation) printf support in stdio.c (Pito)
- **KNOWN ISSUE**: CDC still sometimes fails with heavy traffic ... active debugging in progress
- **KNOWN ISSUE**: RTX tested under LPCXpresso, but not working under CW since startup code needs to be modified so license issues need to be resolved with Rowley
## 0.8.5 [21 May 2013] ##
- Updated CMSIS to v3.20
- Renamed Crossworks project files to CW_*
- Renamed Keil project files to Keil_*
- Added stepper support to board config files
- Changed the clock setup in core/adc
- Added basic TCS34725 driver
- First attempt at a simple binary protocol (CFG_PROTOCOL, /src/protocol)
- Added CFG\_BRD\_SIMULATOR as a board option (mostly for unit tests)
- Fixed negative value bug in timespanCreate
- Renamed /src/drivers/statistics to /src/drivers/filters
- Added some basic Python scripts to test the IIR filter
- Updated LPCXpresso project files to use /cmsis (no more external dependencies)
- Added int32_t iir filter and matching python scripts
- Changed usb HID generic callbacks to be more general
- Replaced 'USB\_HID\_GenericReportOut\_t' and 'USB\_HID\_GenericReportIn\_t' signatures with '(uint8\_t report[] and uint32\_t length)'
- Affected functions are 'usb\_hid\_generic\_recv\_isr', 'usb\_hid\_generic\_report\_request\_isr', and 'usb\_hid\_generic\_send'
- Added CMSIS DSP library to the makefile, LPCXpresso and Crossworks project files
- Added RTX library for CMSIS-RTOS (currently untested)
- Removed all use of GPIOSetBitValue and GPIOSetDir (wasteful fluff)
- Added simple moving average filter and python tester
- Improved fifo_t to support any object size (previously uint8_t only)
- Added ceedling support (experimental)
## 0.8.1 [23 April 2013] ##
- 'main' entry point moved to board-specific files ('src/boards/*')
- Removed main.c from src root
- LPCXpresso/Red Suite project files now default to the LPC1347
- Moved messages.c to drivers/rf/chibi
- Removed some unnecessary files
- Added binary.h to simplify binary access across toolchains (removed '0b' references)
- Added 'get_fattime' to board files (get timestamp for FAT32 and SD cards)
- Moved board selection from projectconfig.h to the make file and IDE project properties
## 0.8.0 [2 April 2013] ##
- First public release
This diff is collapsed.
This diff is collapsed.
/*----------------------------------------------------------------------------
* RL-ARM - RTX
*----------------------------------------------------------------------------
* Name: RTX_CM_LIB.H
* Purpose: RTX Kernel System Configuration
* Rev.: V4.70
*----------------------------------------------------------------------------
*
* Copyright (c) 1999-2009 KEIL, 2009-2013 ARM Germany GmbH
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - 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.
* - Neither the name of ARM 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 COPYRIGHT HOLDERS AND 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.
*---------------------------------------------------------------------------*/
#if defined (__CC_ARM)
#pragma O3
#define __USED __attribute__((used))
#elif defined (__GNUC__)
#pragma GCC optimize ("O3")
#define __USED __attribute__((used))
#elif defined (__ICCARM__)
#define __USED __root
#endif
/*----------------------------------------------------------------------------
* Definitions
*---------------------------------------------------------------------------*/
#define _declare_box(pool,size,cnt) uint32_t pool[(((size)+3)/4)*(cnt) + 3]
#define _declare_box8(pool,size,cnt) uint64_t pool[(((size)+7)/8)*(cnt) + 2]
#define OS_TCB_SIZE 48
#define OS_TMR_SIZE 8
#if defined (__CC_ARM) && !defined (__MICROLIB)
typedef void *OS_ID;
typedef uint32_t OS_TID;
typedef uint32_t OS_MUT[3];
typedef uint32_t OS_RESULT;
#define runtask_id() rt_tsk_self()
#define mutex_init(m) rt_mut_init(m)
#define mutex_wait(m) os_mut_wait(m,0xFFFF)
#define mutex_rel(m) os_mut_release(m)
extern OS_TID rt_tsk_self (void);
extern void rt_mut_init (OS_ID mutex);
extern OS_RESULT rt_mut_release (OS_ID mutex);
extern OS_RESULT rt_mut_wait (OS_ID mutex, uint16_t timeout);
#define os_mut_wait(mutex,timeout) _os_mut_wait((uint32_t)rt_mut_wait,mutex,timeout)
#define os_mut_release(mutex) _os_mut_release((uint32_t)rt_mut_release,mutex)
OS_RESULT _os_mut_release (uint32_t p, OS_ID mutex) __svc_indirect(0);
OS_RESULT _os_mut_wait (uint32_t p, OS_ID mutex, uint16_t timeout) __svc_indirect(0);
#endif
/*----------------------------------------------------------------------------
* Global Variables
*---------------------------------------------------------------------------*/
#if (OS_TIMERS != 0)
#define OS_TASK_CNT (OS_TASKCNT + 1)
#define OS_PRIV_CNT (OS_PRIVCNT + 2)
#define OS_STACK_SZ (4*(OS_PRIVSTKSIZE+OS_MAINSTKSIZE+OS_TIMERSTKSZ))
#else
#define OS_TASK_CNT OS_TASKCNT
#define OS_PRIV_CNT (OS_PRIVCNT + 1)
#define OS_STACK_SZ (4*(OS_PRIVSTKSIZE+OS_MAINSTKSIZE))
#endif
uint16_t const os_maxtaskrun = OS_TASK_CNT;
uint32_t const os_stackinfo = (OS_STKCHECK<<24)| (OS_PRIV_CNT<<16) | (OS_STKSIZE*4);
uint32_t const os_rrobin = (OS_ROBIN << 16) | OS_ROBINTOUT;
uint32_t const os_tickfreq = OS_CLOCK;
uint16_t const os_tickus_i = OS_CLOCK/1000000;
uint16_t const os_tickus_f = (((uint64_t)(OS_CLOCK-1000000*(OS_CLOCK/1000000)))<<16)/1000000;
uint32_t const os_trv = OS_TRV;
uint8_t const os_flags = OS_RUNPRIV;
/* Export following defines to uVision debugger. */
__USED uint32_t const os_clockrate = OS_TICK;
__USED uint32_t const os_timernum = 0;
/* Memory pool for TCB allocation */
_declare_box (mp_tcb, OS_TCB_SIZE, OS_TASK_CNT);
uint16_t const mp_tcb_size = sizeof(mp_tcb);
/* Memory pool for System stack allocation (+os_idle_demon). */
_declare_box8 (mp_stk, OS_STKSIZE*4, OS_TASK_CNT-OS_PRIV_CNT+1);
uint32_t const mp_stk_size = sizeof(mp_stk);
/* Memory pool for user specified stack allocation (+main, +timer) */
uint64_t os_stack_mem[2+OS_PRIV_CNT+(OS_STACK_SZ/8)];
uint32_t const os_stack_sz = sizeof(os_stack_mem);
#ifndef OS_FIFOSZ
#define OS_FIFOSZ 16
#endif
/* Fifo Queue buffer for ISR requests.*/
uint32_t os_fifo[OS_FIFOSZ*2+1];
uint8_t const os_fifo_size = OS_FIFOSZ;
/* An array of Active task pointers. */
void *os_active_TCB[OS_TASK_CNT];
/* User Timers Resources */
#if (OS_TIMERS != 0)
extern void osTimerThread (void const *argument);
osThreadDef(osTimerThread, (osPriority)(OS_TIMERPRIO-3), 1, 4*OS_TIMERSTKSZ);
osThreadId osThreadId_osTimerThread;
osMessageQDef(osTimerMessageQ, OS_TIMERCBQS, void *);
osMessageQId osMessageQId_osTimerMessageQ;
#else
osThreadDef_t os_thread_def_osTimerThread = { NULL };
osThreadId osThreadId_osTimerThread;
osMessageQDef(osTimerMessageQ, 0, void *);
osMessageQId osMessageQId_osTimerMessageQ;
#endif
/* Legacy RTX User Timers not used */
uint32_t os_tmr = 0;
uint32_t const *m_tmr = NULL;
uint16_t const mp_tmr_size = 0;
#if defined (__CC_ARM) && !defined (__MICROLIB)
/* A memory space for arm standard library. */
static uint32_t std_libspace[OS_TASK_CNT][96/4];
static OS_MUT std_libmutex[OS_MUTEXCNT];
static uint32_t nr_mutex;
extern void *__libspace_start;
#endif
/*----------------------------------------------------------------------------
* RTX Optimizations (empty functions)
*---------------------------------------------------------------------------*/
#if OS_ROBIN == 0
void rt_init_robin (void) {;}
void rt_chk_robin (void) {;}
#endif
#if OS_STKCHECK == 0
void rt_stk_check (void) {;}
#endif
/*----------------------------------------------------------------------------
* Standard Library multithreading interface
*---------------------------------------------------------------------------*/
#if defined (__CC_ARM) && !defined (__MICROLIB)
/*--------------------------- __user_perthread_libspace ---------------------*/
void *__user_perthread_libspace (void) {
/* Provide a separate libspace for each task. */
uint32_t idx;
idx = runtask_id ();
if (idx == 0) {
/* RTX not running yet. */
return (&__libspace_start);
}
return ((void *)&std_libspace[idx-1]);
}
/*--------------------------- _mutex_initialize -----------------------------*/
int _mutex_initialize (OS_ID *mutex) {
/* Allocate and initialize a system mutex. */
if (nr_mutex >= OS_MUTEXCNT) {
/* If you are here, you need to increase the number OS_MUTEXCNT. */
for (;;);
}
*mutex = &std_libmutex[nr_mutex++];
mutex_init (*mutex);
return (1);
}
/*--------------------------- _mutex_acquire --------------------------------*/
__attribute__((used)) void _mutex_acquire (OS_ID *mutex) {
/* Acquire a system mutex, lock stdlib resources. */
if (runtask_id ()) {
/* RTX running, acquire a mutex. */
mutex_wait (*mutex);
}
}
/*--------------------------- _mutex_release --------------------------------*/
__attribute__((used)) void _mutex_release (OS_ID *mutex) {
/* Release a system mutex, unlock stdlib resources. */
if (runtask_id ()) {
/* RTX running, release a mutex. */
mutex_rel (*mutex);
}
}
#endif
#if 0
/*----------------------------------------------------------------------------
* RTX Startup
*---------------------------------------------------------------------------*/
/* Main Thread definition */
extern int main (void);
osThreadDef_t os_thread_def_main = {(os_pthread)main, osPriorityNormal, 1, 4*OS_MAINSTKSIZE };
#if defined (__CC_ARM)
#ifdef __MICROLIB
void _main_init (void) __attribute__((section(".ARM.Collect$$$$000000FF")));
void _main_init (void) {
osKernelInitialize();
osThreadCreate(&os_thread_def_main, NULL);
osKernelStart();
for (;;);
}
#else
__asm void __rt_entry (void) {
IMPORT __user_setup_stackheap
IMPORT __rt_lib_init
IMPORT os_thread_def_main
IMPORT osKernelInitialize
IMPORT osKernelStart
IMPORT osThreadCreate
IMPORT exit
BL __user_setup_stackheap
MOV R1,R2
BL __rt_lib_init
BL osKernelInitialize
LDR R0,=os_thread_def_main
MOVS R1,#0
BL osThreadCreate
BL osKernelStart
BL exit
ALIGN
}
#endif
#elif defined (__GNUC__)
#ifdef __CS3__
/* CS3 start_c routine.
*
* Copyright (c) 2006, 2007 CodeSourcery Inc
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "cs3.h"
extern void __libc_init_array (void);
__attribute ((noreturn)) void __cs3_start_c (void){
unsigned regions = __cs3_region_num;
const struct __cs3_region *rptr = __cs3_regions;
/* Initialize memory */
for (regions = __cs3_region_num, rptr = __cs3_regions; regions--; rptr++) {
long long *src = (long long *)rptr->init;
long long *dst = (long long *)rptr->data;
unsigned limit = rptr->init_size;
unsigned count;
if (src != dst)
for (count = 0; count != limit; count += sizeof (long long))
*dst++ = *src++;
else
dst = (long long *)((char *)dst + limit);
limit = rptr->zero_size;
for (count = 0; count != limit; count += sizeof (long long))
*dst++ = 0;
}
/* Run initializers. */
__libc_init_array ();
osKernelInitialize();
osThreadCreate(&os_thread_def_main, NULL);
osKernelStart();
for (;;);
}
#else
__attribute__((naked)) void software_init_hook (void) {
__asm (
".syntax unified\n"
".thumb\n"
"movs r0,#0\n"
"movs r1,#0\n"
"mov r4,r0\n"
"mov r5,r1\n"
"ldr r0,= __libc_fini_array\n"
"bl atexit\n"
"bl __libc_init_array\n"
"mov r0,r4\n"
"mov r1,r5\n"
"bl osKernelInitialize\n"
"ldr r0,=os_thread_def_main\n"
"movs r1,#0\n"
"bl osThreadCreate\n"
"bl osKernelStart\n"
"bl exit\n"
);
}
#endif
#elif defined (__ICCARM__)
extern int __low_level_init(void);
extern void __iar_data_init3(void);
extern void exit(int arg);
__noreturn __stackless void __cmain(void) {
int a;
if (__low_level_init() != 0) {
__iar_data_init3();
}
osKernelInitialize();
osThreadCreate(&os_thread_def_main, NULL);
a = osKernelStart();
exit(a);
}
#endif
#endif
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
/**************************************************************************/
/*!
@file rtx_hook.c
@author Hau Huynh
@brief Board file for the LPC1347 LPCXpresso board from NXP
@ingroup Boards
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2012 K. Townsend
All rights reserved.
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 of the copyright holders 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 ''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 HOLDER 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 "projectconfig.h"
#if defined CFG_CMSIS_RTOS
/*----------------------------------------------------------------------------
* Global Functions
*---------------------------------------------------------------------------*/
/*--------------------------- os_idle_demon ---------------------------------*/
void os_idle_demon (void) {
/* The idle demon is a system thread, running when no other thread is */
/* ready to run. */
for (;;) {
/* HERE: include optional user code to be executed when no thread runs.*/
}
}
#if (OS_SYSTICK == 0) // Functions for alternative timer as RTX kernel timer
/*--------------------------- os_tick_init ----------------------------------*/
// Initialize alternative hardware timer as RTX kernel timer
// Return: IRQ number of the alternative hardware timer
int os_tick_init (void) {
return (-1); /* Return IRQ number of timer (0..239) */
}
/*--------------------------- os_tick_val -----------------------------------*/
// Get alternative hardware timer current value (0 .. OS_TRV)
uint32_t os_tick_val (void) {
return (0);
}
/*--------------------------- os_tick_ovf -----------------------------------*/
// Get alternative hardware timer overflow flag
// Return: 1 - overflow, 0 - no overflow
uint32_t os_tick_ovf (void) {
return (0);
}
/*--------------------------- os_tick_irqack --------------------------------*/
// Acknowledge alternative hardware timer interrupt
void os_tick_irqack (void) {
/* ... */
}
#endif // (OS_SYSTICK == 0)
/*--------------------------- os_error --------------------------------------*/
void os_error (uint32_t err_code) {
/* This function is called when a runtime error is detected. Parameter */
/* 'err_code' holds the runtime error code (defined in RTL.H). */
/* HERE: include optional code to be executed on runtime error. */
for (;;);
}
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
#endif
/* ----------------------------------------------------------------------
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.1
*
* Project: CMSIS DSP Library
* Title: arm_common_tables.h
*
* Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - 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.
* - Neither the name of ARM LIMITED 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 _ARM_COMMON_TABLES_H
#define _ARM_COMMON_TABLES_H
#include "arm_math.h"
extern const uint16_t armBitRevTable[1024];
extern const q15_t armRecipTableQ15[64];
extern const q31_t armRecipTableQ31[64];
extern const q31_t realCoefAQ31[1024];
extern const q31_t realCoefBQ31[1024];
extern const float32_t twiddleCoef_16[32];
extern const float32_t twiddleCoef_32[64];
extern const float32_t twiddleCoef_64[128];
extern const float32_t twiddleCoef_128[256];
extern const float32_t twiddleCoef_256[512];
extern const float32_t twiddleCoef_512[1024];
extern const float32_t twiddleCoef_1024[2048];
extern const float32_t twiddleCoef_2048[4096];
extern const float32_t twiddleCoef_4096[8192];
#define twiddleCoef twiddleCoef_4096
extern const q31_t twiddleCoefQ31[6144];
extern const q15_t twiddleCoefQ15[6144];
extern const float32_t twiddleCoef_rfft_32[32];
extern const float32_t twiddleCoef_rfft_64[64];
extern const float32_t twiddleCoef_rfft_128[128];
extern const float32_t twiddleCoef_rfft_256[256];
extern const float32_t twiddleCoef_rfft_512[512];
extern const float32_t twiddleCoef_rfft_1024[1024];
extern const float32_t twiddleCoef_rfft_2048[2048];
extern const float32_t twiddleCoef_rfft_4096[4096];
#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 )
#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 )
#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 )
#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
#endif /* ARM_COMMON_TABLES_H */
/* ----------------------------------------------------------------------
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
*
* $Date: 17. January 2013
* $Revision: V1.4.1
*
* Project: CMSIS DSP Library
* Title: arm_const_structs.h
*
* Description: This file has constant structs that are initialized for
* user convenience. For example, some can be given as
* arguments to the arm_cfft_f32() function.
*
* Target Processor: Cortex-M4/Cortex-M3
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - 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.
* - Neither the name of ARM LIMITED 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 _ARM_CONST_STRUCTS_H
#define _ARM_CONST_STRUCTS_H
#include "arm_math.h"
#include "arm_common_tables.h"
const arm_cfft_instance_f32 arm_cfft_sR_f32_len16 = {
16, twiddleCoef_16, armBitRevIndexTable16, ARMBITREVINDEXTABLE__16_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len32 = {
32, twiddleCoef_32, armBitRevIndexTable32, ARMBITREVINDEXTABLE__32_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len64 = {
64, twiddleCoef_64, armBitRevIndexTable64, ARMBITREVINDEXTABLE__64_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len128 = {
128, twiddleCoef_128, armBitRevIndexTable128, ARMBITREVINDEXTABLE_128_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len256 = {
256, twiddleCoef_256, armBitRevIndexTable256, ARMBITREVINDEXTABLE_256_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len512 = {
512, twiddleCoef_512, armBitRevIndexTable512, ARMBITREVINDEXTABLE_512_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024 = {
1024, twiddleCoef_1024, armBitRevIndexTable1024, ARMBITREVINDEXTABLE1024_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048 = {
2048, twiddleCoef_2048, armBitRevIndexTable2048, ARMBITREVINDEXTABLE2048_TABLE_LENGTH
};
const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096 = {
4096, twiddleCoef_4096, armBitRevIndexTable4096, ARMBITREVINDEXTABLE4096_TABLE_LENGTH
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment