├── data └── test-romfs │ ├── test.txt │ ├── manual │ └── freertos │ ├── 404.html │ └── index.html ├── freertos ├── libraries │ ├── FreeRTOS │ │ ├── portable │ │ │ ├── MPLAB │ │ │ │ └── PIC18F │ │ │ │ │ └── stdio.h │ │ │ ├── Keil │ │ │ │ └── See-also-the-RVDS-directory.txt │ │ │ ├── Rowley │ │ │ │ ├── ARM7 │ │ │ │ │ └── readme.txt │ │ │ │ └── MSP430F449 │ │ │ │ │ └── portasm.h │ │ │ ├── IAR │ │ │ │ ├── AtmelSAM7S64 │ │ │ │ │ ├── lib_AT91SAM7X128.h │ │ │ │ │ ├── lib_AT91SAM7X256.h │ │ │ │ │ ├── ISR_Support.h │ │ │ │ │ └── portasm.s79 │ │ │ │ ├── AtmelSAM9XE │ │ │ │ │ ├── portasm.s79 │ │ │ │ │ └── ISR_Support.h │ │ │ │ ├── AVR32_UC3 │ │ │ │ │ ├── read.c │ │ │ │ │ └── write.c │ │ │ │ ├── STR75x │ │ │ │ │ ├── portasm.s79 │ │ │ │ │ └── ISR_Support.h │ │ │ │ ├── MSP430X │ │ │ │ │ └── data_model.h │ │ │ │ ├── STR71x │ │ │ │ │ ├── portasm.s79 │ │ │ │ │ └── ISR_Support.h │ │ │ │ ├── RL78 │ │ │ │ │ └── portasm.s87 │ │ │ │ ├── LPC2000 │ │ │ │ │ ├── portasm.s79 │ │ │ │ │ └── ISR_Support.h │ │ │ │ ├── STR91x │ │ │ │ │ └── portasm.s79 │ │ │ │ └── MSP430 │ │ │ │ │ └── portasm.h │ │ │ ├── GCC │ │ │ │ ├── ARM7_AT91SAM7S │ │ │ │ │ ├── lib_AT91SAM7X256.h │ │ │ │ │ └── lib_AT91SAM7X256.c │ │ │ │ ├── PPC405_Xilinx │ │ │ │ │ └── FPU_Macros.h │ │ │ │ └── PPC440_Xilinx │ │ │ │ │ └── FPU_Macros.h │ │ │ ├── Softune │ │ │ │ ├── MB91460 │ │ │ │ │ └── __STD_LIB_sbrk.c │ │ │ │ └── MB96340 │ │ │ │ │ └── __STD_LIB_sbrk.c │ │ │ ├── readme.txt │ │ │ ├── Renesas │ │ │ │ ├── RX200 │ │ │ │ │ └── port_asm.src │ │ │ │ ├── RX600 │ │ │ │ │ └── port_asm.src │ │ │ │ └── SH2A_FPU │ │ │ │ │ └── ISR_Support.inc │ │ │ ├── CCS │ │ │ │ └── MSP430X │ │ │ │ │ └── data_model.h │ │ │ ├── WizC │ │ │ │ └── PIC18 │ │ │ │ │ └── addFreeRTOS.h │ │ │ └── RVDS │ │ │ │ └── ARM7_LPC21xx │ │ │ │ └── portmacro.inc │ │ ├── readme.txt │ │ └── include │ │ │ └── projdefs.h │ ├── CMSIS │ │ ├── License.doc │ │ ├── CMSIS debug support.htm │ │ ├── Documentation │ │ │ └── CMSIS_Core.htm │ │ └── CM3 │ │ │ └── DeviceSupport │ │ │ └── ST │ │ │ └── STM32F10x │ │ │ └── system_stm32f10x.h │ └── STM32F10x_StdPeriph_Driver │ │ ├── src │ │ ├── stm32f10x_i2c.c │ │ ├── stm32f10x_flash.c │ │ ├── stm32f10x_usart.c │ │ └── stm32f10x_crc.c │ │ └── inc │ │ ├── stm32f10x_crc.h │ │ ├── stm32f10x_wwdg.h │ │ ├── stm32f10x_dbgmcu.h │ │ ├── stm32f10x_iwdg.h │ │ ├── stm32f10x_rtc.h │ │ └── stm32f10x_pwr.h ├── test.script ├── main.ld ├── stm32_p103.h ├── emulate.sh ├── gdbscript ├── gdb2vcd.pl ├── Makefile ├── stm32f10x_conf.h └── stm32_p103.c ├── src ├── osdebug.c ├── hash-djb2.c ├── string-util.c ├── host.c ├── dir.c ├── filesystem.c ├── romfs.c ├── clib.c ├── mmtest.c └── stm32_p103.c ├── tool ├── gdbscript ├── emulate.sh └── mkromfs.c ├── .gitignore ├── include ├── osdebug.h ├── hash-djb2.h ├── shell.h ├── romfs.h ├── dir.h ├── filesystem.h ├── clib.h ├── stm32_p103.h ├── host.h ├── fio.h └── stm32f10x_conf.h ├── romfs.txt ├── README ├── mk ├── romfs.mk └── qemu.mk ├── main.ld └── Makefile /data/test-romfs/test.txt: -------------------------------------------------------------------------------- 1 | Romfs Test! 2 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/MPLAB/PIC18F/stdio.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/osdebug.c: -------------------------------------------------------------------------------- 1 | void osDbgPrintf(const char * fmt, ...) { } 2 | -------------------------------------------------------------------------------- /freertos/test.script: -------------------------------------------------------------------------------- 1 | # Sample input sequence 2 | ABCDEFGHIJK 3 | LMLOPGQSTUVW 4 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Keil/See-also-the-RVDS-directory.txt: -------------------------------------------------------------------------------- 1 | Nothing to see here. -------------------------------------------------------------------------------- /tool/gdbscript: -------------------------------------------------------------------------------- 1 | file build/main.elf 2 | target remote :3333 3 | 4 | b main 5 | 6 | c 7 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Rowley/ARM7/readme.txt: -------------------------------------------------------------------------------- 1 | The Rowley ARM7 demo uses the GCC ARM7 port files. -------------------------------------------------------------------------------- /freertos/libraries/CMSIS/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/CMSIS/License.doc -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | main.bin 2 | main.elf 3 | main.list 4 | *.o 5 | mkromfs 6 | test-romfs.bin 7 | *.swp 8 | *~ 9 | build 10 | output 11 | tags 12 | -------------------------------------------------------------------------------- /freertos/libraries/CMSIS/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/CMSIS/CMSIS debug support.htm -------------------------------------------------------------------------------- /freertos/libraries/CMSIS/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/CMSIS/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /include/osdebug.h: -------------------------------------------------------------------------------- 1 | #ifndef __OSDEBUG_H__ 2 | #define __OSDEBUG_H__ 3 | 4 | void osDbgPrintf(const char * fmt, ...); 5 | 6 | #define DBGOUT osDbgPrintf 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/embedded2015/freertos-basic/HEAD/freertos/libraries/FreeRTOS/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h -------------------------------------------------------------------------------- /include/hash-djb2.h: -------------------------------------------------------------------------------- 1 | #ifndef __HASH_DJB2_H__ 2 | #define __HASH_DJB2_H__ 3 | 4 | #include 5 | #include 6 | 7 | uint32_t hash_djb2(const uint8_t * str, ssize_t max); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /include/shell.h: -------------------------------------------------------------------------------- 1 | #ifndef SHELL_H 2 | #define SHELL_H 3 | 4 | int parse_command(char *str, char *argv[]); 5 | 6 | typedef void cmdfunc(int, char *[]); 7 | 8 | cmdfunc *do_command(const char *str); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/romfs.h: -------------------------------------------------------------------------------- 1 | #ifndef __ROMFS_H__ 2 | #define __ROMFS_H__ 3 | 4 | #include 5 | 6 | void register_romfs(const char * mountpoint, const uint8_t * romfs); 7 | const uint8_t * romfs_get_file_by_hash(const uint8_t * romfs, uint32_t h, uint32_t * len); 8 | 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /romfs.txt: -------------------------------------------------------------------------------- 1 | Format is excessively simple and short. Read the source for help. 2 | 3 | Converting to an object: 4 | 5 | $ arm-none-eabi-objcopy -I binary -O elf32-littlearm \ 6 | --prefix-sections '.romfs' --binary-architecture arm my-romfs.bin my-romfs.o 7 | 8 | 9 | Note: this format has absolutely nothing in common with Linux's romfs. 10 | -------------------------------------------------------------------------------- /src/hash-djb2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hash-djb2.h" 3 | #include "osdebug.h" 4 | 5 | uint32_t hash_djb2(const uint8_t * str, ssize_t _max) { 6 | uint32_t hash = 5381; 7 | uint32_t max = (uint32_t) _max; 8 | int c; 9 | 10 | while (((c = *str++)) && max--) { 11 | hash = ((hash << 5) + hash) ^ c; 12 | } 13 | 14 | return hash; 15 | } 16 | -------------------------------------------------------------------------------- /data/test-romfs/manual/freertos: -------------------------------------------------------------------------------- 1 | FREETOS is a market leading real time operating system (or RTOS) from Real Time Engineers Ltd. that supports 34 architectures and receives 103000 downloads a year. It is professionally developed, strictly quality controlled, robust, supported, and free to use in commercial products without any requirement to expose your proprietary source code. It is used in every imaginable market sector from toys to aircraft navigation. 2 | -------------------------------------------------------------------------------- /data/test-romfs/404.html: -------------------------------------------------------------------------------- 1 | 2 | Embedded 3 | 4 | 5 | 6 | 17 |
7 | 8 |

Lightweight web server

9 |

404 - Page not found

10 |

11 | Sorry, the page you are requesting was not found on this 12 | server. 13 |

14 |
15 |   16 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | A FreeRTOS distribution for STM32-P103 with customized features 2 | 3 | Contributors: 4 | Zhe-An Lin 5 | Jim Huang 6 | Tim Hsu 7 | Jeff Liaw 8 | Eddy Wu 9 | 10 | External source from FreeRTOS is copyrighted by: 11 | Real Time Engineers Ltd. 12 | 13 | External source from CMSIS/ST is copyrighted by: 14 | STMicroelectronics 15 | ARM Ltd 16 | -------------------------------------------------------------------------------- /mk/romfs.mk: -------------------------------------------------------------------------------- 1 | ROMDIR = $(DATDIR)/test-romfs 2 | DAT += $(OUTDIR)/$(DATDIR)/test-romfs.o 3 | 4 | $(OUTDIR)/$(ROMDIR).o: $(OUTDIR)/$(ROMDIR).bin 5 | @mkdir -p $(dir $@) 6 | @echo " OBJCOPY "$@ 7 | @$(CROSS_COMPILE)objcopy -I binary -O elf32-littlearm -B arm \ 8 | --prefix-sections '.romfs' $< $@ 9 | 10 | $(OUTDIR)/$(ROMDIR).bin: $(ROMDIR) $(OUTDIR)/$(TOOLDIR)/mkromfs 11 | @mkdir -p $(dir $@) 12 | @echo " MKROMFS "$@ 13 | @$(OUTDIR)/$(TOOLDIR)/mkromfs -d $< $@ 14 | 15 | $(ROMDIR): 16 | @mkdir -p $@ 17 | 18 | $(OUTDIR)/%/mkromfs: %/mkromfs.c 19 | @mkdir -p $(dir $@) 20 | @echo " CC "$@ 21 | @gcc -Wall -o $@ $^ 22 | -------------------------------------------------------------------------------- /tool/emulate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QEMU_STM32=../qemu_stm32/arm-softmmu/qemu-system-arm 4 | 5 | CUR=`dirname $0` 6 | 7 | emulate () { 8 | $QEMU_STM32 \ 9 | -M stm32-p103 \ 10 | -kernel $1 \ 11 | -serial stdio \ 12 | -parallel none \ 13 | -monitor tcp:localhost:4444,server,nowait <&0 & pid=$! 14 | } 15 | 16 | stm32_qemu () { 17 | emulate $1 18 | 19 | echo "Modeling STM32 in QEMU..." 20 | (sleep $2; kill $pid; sleep 1; kill -KILL $pid)& timer=$! 21 | if ! wait $pid; then 22 | kill $timer 2>/dev/null 23 | echo 24 | echo "Modeling failed to execute in $2 seconds, giving up." 25 | exit -1 26 | fi 27 | kill $timer 28 | } 29 | 30 | stm32_qemu $1 5 31 | -------------------------------------------------------------------------------- /include/dir.h: -------------------------------------------------------------------------------- 1 | #ifndef __DIR_H_ 2 | #define __DIR_H__ 3 | 4 | #include 5 | 6 | #define MAX_DIRS 32 7 | 8 | #define ENOTOPEN -1 9 | #define ENOTSUPPORT -2 10 | 11 | typedef int (*dirnext_t)(void * opaque, void * buf, size_t bufsize); 12 | typedef int (*dirclose_t)(void * opaque); 13 | 14 | typedef struct dirdef_t { 15 | dirnext_t dirnext; 16 | dirclose_t dirclose; 17 | void * opaque; 18 | }dirdef_t; 19 | 20 | int dir_open(dirnext_t dirnext, dirclose_t dirclose, void * opaque); 21 | int dir_is_open(int fd); 22 | int dir_next(int dird, void * buf, size_t bufsize); 23 | int dir_close(int dird); 24 | void dir_set_opaque(int dird, void * opaque); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /mk/qemu.mk: -------------------------------------------------------------------------------- 1 | QEMU_STM32 ?= ../qemu_stm32/arm-softmmu/qemu-system-arm 2 | BUILD_TARGET = $(OUTDIR)/$(TARGET) 3 | export SHELL := /bin/bash 4 | 5 | qemu: $(BUILD_TARGET).bin $(QEMU_STM32) 6 | $(QEMU_STM32) -M stm32-p103 \ 7 | -monitor stdio \ 8 | -kernel $(BUILD_TARGET).bin \ 9 | -semihosting 10 | 11 | qemudbg: $(BUILD_TARGET).bin $(QEMU_STM32) 12 | $(QEMU_STM32) -M stm32-p103 \ 13 | -monitor stdio \ 14 | -gdb tcp::3333 -S \ 15 | -kernel $(BUILD_TARGET).bin -semihosting 2>&1>/dev/null & \ 16 | echo $$! > $(OUTDIR)/qemu_pid && \ 17 | $(CROSS_COMPILE)gdb -x $(TOOLDIR)/gdbscript && \ 18 | cat $(OUTDIR)/qemu_pid | `xargs kill 2>/dev/null || test true` && \ 19 | rm -f $(OUTDIR)/qemu_pid 20 | 21 | -------------------------------------------------------------------------------- /freertos/main.ld: -------------------------------------------------------------------------------- 1 | ENTRY(main) 2 | MEMORY 3 | { 4 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K 5 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K 6 | 7 | } 8 | 9 | SECTIONS 10 | { 11 | .text : 12 | { 13 | KEEP(*(.isr_vector)) 14 | *(.text) 15 | *(.text.*) 16 | *(.rodata) 17 | _sidata = .; 18 | } >FLASH 19 | 20 | /* Initialized data will initially be loaded in FLASH at the end of the .text section. */ 21 | .data : AT (_sidata) 22 | { 23 | _sdata = .; 24 | *(.data) /* Initialized data */ 25 | _edata = .; 26 | } >RAM 27 | 28 | .bss : { 29 | _sbss = .; 30 | *(.bss) /* Zero-filled run time allocate data memory */ 31 | _ebss = .; 32 | } >RAM 33 | 34 | _estack = ORIGIN(RAM) + LENGTH(RAM); 35 | } -------------------------------------------------------------------------------- /include/filesystem.h: -------------------------------------------------------------------------------- 1 | #ifndef __FILESYSTEM_H__ 2 | #define __FILESYSTEM_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define MAX_FS 16 8 | #define OPENFAIL (-1) 9 | 10 | #define OPENDIR_NOTFOUNDFS (-2) 11 | #define OPENDIR_NOTFOUND (-1) 12 | 13 | typedef int (*fs_open_t)(void * opaque, const char * fname, int flags, int mode); 14 | typedef int (*fs_open_dir_t)(void * opaque, const char * fname); 15 | 16 | /* Need to be called before using any other fs functions */ 17 | __attribute__((constructor)) void fs_init(); 18 | 19 | int register_fs(const char * mountpoint, fs_open_t callback, fs_open_dir_t dir_callback, void * opaque); 20 | int fs_open(const char * path, int flags, int mode); 21 | int fs_opendir(const char * path); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /include/clib.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIB_H 2 | #define CLIB_H 3 | 4 | /* Altough there already has string_utils 5 | * i would like seperate to my version of c library and the original 6 | * NOTE: string-utils.c use string.h's declarations 7 | */ 8 | 9 | #include 10 | 11 | /* fprintf for fio */ 12 | size_t fio_printf(int fd, const char *format, ...); 13 | int sprnitf(char *, const char *, ...); 14 | 15 | /* I would like to rename itoa as to_string (idea from C++11) 16 | * however c doesn't allow function overloading */ 17 | char *itoa(const char *numbox, int i, unsigned int base); 18 | char *utoa(const char *numbox, unsigned int i, unsigned int base); 19 | 20 | char *strcat(char * restrict dest, const char * restrict source); 21 | size_t strlen(const char *str); 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /include/stm32_p103.h: -------------------------------------------------------------------------------- 1 | #ifndef __STM32_P103_H 2 | #define __STM32_P103_H 3 | 4 | /* This library contains routines for interfacing with the STM32 P103 board. */ 5 | 6 | /* Initialize the LED (the board only has one). */ 7 | void init_led(void); 8 | 9 | /* Initialize the button (the board only has one). */ 10 | void init_button(void); 11 | 12 | /* Configures the RS232 serial port using the following settings: 13 | * 9600 Baud 14 | * 8 bits + 1 stop bit 15 | * No parity bit 16 | * No hardware flow control 17 | * Note that the USART2 is not enabled in this routine. It is left disabled in 18 | * case any additional configuration is needed. 19 | */ 20 | void init_rs232(void); 21 | 22 | void enable_rs232_interrupts(void); 23 | 24 | void enable_rs232(void); 25 | 26 | #endif /* __STM32_P103_H */ 27 | -------------------------------------------------------------------------------- /freertos/stm32_p103.h: -------------------------------------------------------------------------------- 1 | #ifndef __STM32_P103_H 2 | #define __STM32_P103_H 3 | 4 | /* This library contains routines for interfacing with the STM32 P103 board. */ 5 | 6 | /* Initialize the LED (the board only has one). */ 7 | void init_led(void); 8 | 9 | /* Initialize the button (the board only has one). */ 10 | void init_button(void); 11 | 12 | /* Configures the RS232 serial port using the following settings: 13 | * 9600 Baud 14 | * 8 bits + 1 stop bit 15 | * No parity bit 16 | * No hardware flow control 17 | * Note that the USART2 is not enabled in this routine. It is left disabled in 18 | * case any additional configuration is needed. 19 | */ 20 | void init_rs232(void); 21 | 22 | void enable_rs232_interrupts(void); 23 | 24 | void enable_rs232(void); 25 | 26 | #endif /* __STM32_P103_H */ 27 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Softune/MB91460/__STD_LIB_sbrk.c: -------------------------------------------------------------------------------- 1 | #include "FreeRTOSConfig.h" 2 | #include 3 | 4 | static long brk_siz = 0; 5 | // #if configTOTAL_HEAP_SIZE != 0 6 | typedef int _heep_t; 7 | #define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1)) 8 | static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)]; 9 | #define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE) 10 | /* #else 11 | extern char *_heep; 12 | extern long _heep_size; 13 | #endif 14 | */ 15 | extern char *sbrk(int size) 16 | { 17 | if (brk_siz + size > _heep_size || brk_siz + size < 0) 18 | 19 | return((char*)-1); 20 | brk_siz += size; 21 | return( (char*)_heep + brk_siz - size); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /freertos/emulate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QEMU_STM32=../qemu_stm32/arm-softmmu/qemu-system-arm 4 | 5 | emulate () { 6 | $QEMU_STM32 \ 7 | -M stm32-p103 \ 8 | -gdb tcp::3333 -S \ 9 | -nographic \ 10 | -kernel $1 & qemu_pid=$! 11 | } 12 | 13 | stm32_qemu () { 14 | emulate $1 1> /dev/null 15 | echo "" > gdb.txt 16 | arm-none-eabi-gdb -x gdbscript 1> /dev/null & gdb_pid=$! 17 | 18 | echo "Modeling STM32 in QEMU..." 19 | (sleep $2 20 | kill $gdb_pid 21 | kill $qemu_pid 22 | sleep 1 23 | kill -KILL $gdb_pid 24 | kill -KILL $qemu_pid 25 | )& timer=$! 26 | if ! wait $qemu_pid; then 27 | kill $timer 2>/dev/null 28 | echo 29 | echo "Modeling failed to execute in $2 seconds, giving up." 30 | exit -1 31 | else 32 | perl gdb2vcd.pl gdb.txt 33 | fi 34 | kill $timer 35 | } 36 | 37 | stm32_qemu $1 5 38 | -------------------------------------------------------------------------------- /main.ld: -------------------------------------------------------------------------------- 1 | ENTRY(main) 2 | MEMORY 3 | { 4 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K 5 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 80K 6 | 7 | } 8 | 9 | SECTIONS 10 | { 11 | .text : 12 | { 13 | KEEP(*(.isr_vector)) 14 | *(.text) 15 | *(.text.*) 16 | *(.rodata) 17 | *(.rodata*) 18 | _sromfs = .; 19 | *(.rom*) 20 | _eromfs = .; 21 | _sidata = .; 22 | } >FLASH 23 | 24 | /* Initialized data will initially be loaded in FLASH at the end of the .text section. */ 25 | .data : AT (_sidata) 26 | { 27 | _sdata = .; 28 | *(.data) /* Initialized data */ 29 | _edata = .; 30 | } >RAM 31 | 32 | .bss : { 33 | _sbss = .; 34 | *(.bss) /* Zero-filled run time allocate data memory */ 35 | _ebss = .; 36 | } >RAM 37 | 38 | _estack = ORIGIN(RAM) + LENGTH(RAM); 39 | } 40 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and/or compiler. 4 | 5 | 6 | + The FreeRTOS/Source/Portable/MemMang directory contains the three sample 7 | memory allocators as described on the http://www.FreeRTOS.org WEB site. 8 | 9 | + The other directories each contain files specific to a particular 10 | microcontroller or compiler. 11 | 12 | 13 | 14 | For example, if you are interested in the GCC port for the ATMega323 15 | microcontroller then the port specific files are contained in 16 | FreeRTOS/Source/Portable/GCC/ATMega323 directory. If this is the only 17 | port you are interested in then all the other directories can be 18 | ignored. 19 | 20 | -------------------------------------------------------------------------------- /data/test-romfs/index.html: -------------------------------------------------------------------------------- 1 | 2 | Embedded System Lecture in NCKU 2012 3 | 4 | 5 | 6 | 24 |
7 | 8 |

Embedded

9 |

10 | The web page you are watching was served by a simple web 11 | server running on top of the lightweight TCP/IP stack lwIP. 13 |

14 |

15 | The focus of the lwIP TCP/IP implementation is to reduce 16 | the RAM usage while still having a full scale TCP. This 17 | makes lwIP suitable for use in embedded systems with tens 18 | of kilobytes of free RAM and room for around 40 kilobytes 19 | of code ROM. 20 |

21 |
22 |   23 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and or compiler. 4 | 5 | + The FreeRTOS/Source directory contains the three files that are common to 6 | every port - list.c, queue.c and tasks.c. The kernel is contained within these 7 | three files. croutine.c implements the optional co-routine functionality - which 8 | is normally only used on very memory limited systems. 9 | 10 | + The FreeRTOS/Source/Portable directory contains the files that are specific to 11 | a particular microcontroller and or compiler. 12 | 13 | + The FreeRTOS/Source/include directory contains the real time kernel header 14 | files. 15 | 16 | See the readme file in the FreeRTOS/Source/Portable directory for more 17 | information. -------------------------------------------------------------------------------- /include/host.h: -------------------------------------------------------------------------------- 1 | #ifndef HOST_H 2 | #define HOST_H 3 | #include 4 | #include 5 | 6 | 7 | /* 8 | *Reference: http://albert-oma.blogspot.tw/2012/04/semihosting.html 9 | */ 10 | enum HOST_SYSCALL{ 11 | SYS_OPEN=0x01, 12 | SYS_CLOSE, 13 | SYS_WRITEC, 14 | SYS_WRITE0, 15 | SYS_WRITE, 16 | SYS_READ, 17 | SYS_READC, 18 | SYS_ISERROR, 19 | SYS_ISTTY, 20 | SYS_SEEK, 21 | SYS_FLEN=0xC, 22 | SYS_TMPNAM, 23 | SYS_REMOVE, 24 | SYS_RENAME, 25 | SYS_CLOCK, 26 | SYS_TIME, 27 | SYS_SYSTEM, 28 | SYS_ERRNO, 29 | SYS_GET_CMDLINE=0x15, 30 | SYS_HEAPINFO, 31 | SYS_ELAPSED=0x30, 32 | SYS_TICKFREQ 33 | }; 34 | 35 | int host_call(enum HOST_SYSCALL, void *argv) __attribute__((naked)); 36 | 37 | int host_system(va_list v1); 38 | int host_open(va_list v1); 39 | int host_close(va_list v1); 40 | int host_write(va_list v1); 41 | 42 | int host_action(enum HOST_SYSCALL action, ...); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /freertos/gdbscript: -------------------------------------------------------------------------------- 1 | set $DEBUG = 0 2 | 3 | set print repeats 0 4 | set print null-stop 5 | 6 | file main.elf 7 | 8 | set $prevTime = 0 9 | define printContextInfo 10 | set $currTime = myTraceGetTimeMillisecond() 11 | 12 | if($currTime <= $prevTime) 13 | # In 'xPortSysTickHandler', 'NVIC_PENDSV' is set before 14 | # calling 'vTaskIncrementTick' so the program is breaked by GDB 15 | # before xTickCount increasing. 16 | set $currTime = $currTime + 10 17 | end 18 | 19 | output /u $currTime 20 | 21 | if($DEBUG) 22 | echo ; 23 | output /u xTickCount * 10 24 | echo ; 25 | output /f myTraceGetTick() * 10 26 | end 27 | echo , 28 | output /a pxCurrentTCB 29 | echo \n 30 | 31 | set $prevTime = $currTime 32 | end 33 | 34 | b myTraceCreate 35 | commands 1 36 | silent 37 | echo %create, 38 | output /a ((tskTCB *)$r0) 39 | echo , 40 | output ((tskTCB *)$r0)->pcTaskName 41 | echo \n 42 | c 43 | end 44 | 45 | b myTraceSwitchedOut 46 | commands 2 47 | silent 48 | echo %out, 49 | printContextInfo 50 | c 51 | end 52 | 53 | b myTraceSwitchedIn 54 | commands 3 55 | silent 56 | echo %in, 57 | printContextInfo 58 | c 59 | end 60 | 61 | set logging on 62 | target remote :3333 63 | c 64 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Softune/MB96340/__STD_LIB_sbrk.c: -------------------------------------------------------------------------------- 1 | /* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */ 2 | /* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */ 3 | /* ELIGIBILITY FOR ANY PURPOSES. */ 4 | /* (C) Fujitsu Microelectronics Europe GmbH */ 5 | /*--------------------------------------------------------------------------- 6 | __STD_LIB_sbrk.C 7 | - Used by heap_3.c for memory accocation and deletion. 8 | 9 | /*---------------------------------------------------------------------------*/ 10 | 11 | #include "FreeRTOSConfig.h" 12 | #include 13 | 14 | static long brk_siz = 0; 15 | typedef int _heep_t; 16 | #define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1)) 17 | static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)]; 18 | #define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE) 19 | 20 | extern char *sbrk(int size) 21 | { 22 | if (brk_siz + size > _heep_size || brk_siz + size < 0) 23 | 24 | return((char*)-1); 25 | brk_siz += size; 26 | return( (char*)_heep + brk_siz - size); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM9XE/portasm.s79: -------------------------------------------------------------------------------- 1 | RSEG ICODE:CODE 2 | CODE32 3 | 4 | EXTERN vTaskSwitchContext 5 | 6 | PUBLIC vPortYieldProcessor 7 | PUBLIC vPortStartFirstTask 8 | 9 | #include "ISR_Support.h" 10 | 11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12 | ; Starting the first task is just a matter of restoring the context that 13 | ; was created by pxPortInitialiseStack(). 14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 15 | vPortStartFirstTask: 16 | portRESTORE_CONTEXT 17 | 18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 19 | ; Manual context switch function. This is the SWI hander. 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21 | vPortYieldProcessor: 22 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 23 | ; as if the context was saved during and IRQ 24 | ; handler. 25 | 26 | portSAVE_CONTEXT ; Save the context of the current task... 27 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 28 | mov lr, pc 29 | BX R0 30 | portRESTORE_CONTEXT ; Restore the context of the selected task. 31 | 32 | 33 | END 34 | 35 | -------------------------------------------------------------------------------- /include/fio.h: -------------------------------------------------------------------------------- 1 | #ifndef __FIO_H__ 2 | #define __FIO_H__ 3 | 4 | #include 5 | 6 | enum open_types_t { 7 | O_RDONLY = 0, 8 | O_WRONLY = 1, 9 | O_RDWR = 2, 10 | O_CREAT = 4, 11 | O_TRUNC = 8, 12 | O_APPEND = 16, 13 | }; 14 | 15 | #define MAX_FDS 32 16 | 17 | typedef ssize_t (*fdread_t)(void * opaque, void * buf, size_t count); 18 | typedef ssize_t (*fdwrite_t)(void * opaque, const void * buf, size_t count); 19 | typedef off_t (*fdseek_t)(void * opaque, off_t offset, int whence); 20 | typedef int (*fdclose_t)(void * opaque); 21 | 22 | struct fddef_t { 23 | fdread_t fdread; 24 | fdwrite_t fdwrite; 25 | fdseek_t fdseek; 26 | fdclose_t fdclose; 27 | void * opaque; 28 | }; 29 | 30 | 31 | /* Need to be called before using any other fio functions */ 32 | __attribute__((constructor)) void fio_init(); 33 | 34 | int fio_is_open(int fd); 35 | int fio_open(fdread_t, fdwrite_t, fdseek_t, fdclose_t, void * opaque); 36 | ssize_t fio_read(int fd, void * buf, size_t count); 37 | ssize_t fio_write(int fd, const void * buf, size_t count); 38 | off_t fio_seek(int fd, off_t offset, int whence); 39 | int fio_close(int fd); 40 | void fio_set_opaque(int fd, void * opaque); 41 | 42 | void register_devfs(); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /freertos/gdb2vcd.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | 5 | use feature "switch"; 6 | use POSIX(); 7 | 8 | sub main{ 9 | my @handles; 10 | my @vars; 11 | my %dumpvars; 12 | 13 | open(SRC, "<", $_[0]) or die $!; 14 | while(){ 15 | my @args = split(","); 16 | my $type = $args[0]; 17 | given($type) 18 | { 19 | when('%create'){ 20 | my $handle = $args[1]; 21 | my $name = substr($args[2]=~s/ /_/gr, 1, -2); 22 | push @handles, $handle; 23 | push @vars, "\$var wire 1 $handle $name \$end"; 24 | } 25 | when('%in'){ 26 | scalar @args == 3 or continue; 27 | 28 | my $time = POSIX::floor($args[1]); 29 | my $dump = "b1 $args[2]"; 30 | $dumpvars{$time} or $dumpvars{$time} = []; 31 | push @{$dumpvars{$time}}, $dump; 32 | } 33 | when('%out'){ 34 | scalar @args == 3 or continue; 35 | 36 | my $time = POSIX::floor($args[1]); 37 | my $dump = "b0 $args[2]"; 38 | $dumpvars{$time} or $dumpvars{$time} = []; 39 | push @{$dumpvars{$time}}, $dump; 40 | } 41 | } 42 | } 43 | close(SRC); 44 | 45 | open(DST, ">", "sched.vcd"); 46 | 47 | # Header 48 | print DST "\$version\n\$end\n"; 49 | print DST "\$timescale 1 ms\n\$end\n"; 50 | 51 | # Vars 52 | for(@vars){ 53 | print DST "$_\n"; 54 | } 55 | 56 | # Dumpvars 57 | 58 | print DST "#0\n"; 59 | for(@handles){ 60 | print DST "b0 $_\n"; 61 | } 62 | for my $time (sort {$a <=> $b} keys %dumpvars){ 63 | print DST "#$time\n"; 64 | for(@{$dumpvars{$time}}){ 65 | print DST "$_\n"; 66 | } 67 | } 68 | 69 | close(DST); 70 | } 71 | 72 | main($ARGV[0]); 73 | -------------------------------------------------------------------------------- /src/string-util.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define ALIGN (sizeof(size_t)) 6 | #define ONES ((size_t)-1/UCHAR_MAX) 7 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 8 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 9 | 10 | #define SS (sizeof(size_t)) 11 | void *memset(void *dest, int c, size_t n) 12 | { 13 | unsigned char *s = dest; 14 | c = (unsigned char)c; 15 | for (; ((uintptr_t)s & ALIGN) && n; n--) *s++ = c; 16 | if (n) { 17 | size_t *w, k = ONES * c; 18 | for (w = (void *)s; n>=SS; n-=SS, w++) *w = k; 19 | for (s = (void *)w; n; n--, s++) *s = c; 20 | } 21 | return dest; 22 | } 23 | 24 | void *memcpy(void *dest, const void *src, size_t n) 25 | { 26 | void *ret = dest; 27 | 28 | //Cut rear 29 | uint8_t *dst8 = dest; 30 | const uint8_t *src8 = src; 31 | switch (n % 4) { 32 | case 3 : *dst8++ = *src8++; 33 | case 2 : *dst8++ = *src8++; 34 | case 1 : *dst8++ = *src8++; 35 | case 0 : ; 36 | } 37 | 38 | //stm32 data bus width 39 | uint32_t *dst32 = (void *)dst8; 40 | const uint32_t *src32 = (void *)src8; 41 | n = n / 4; 42 | while (n--) { 43 | *dst32++ = *src32++; 44 | } 45 | 46 | return ret; 47 | } 48 | 49 | char *strchr(const char *s, int c) 50 | { 51 | for (; *s && *s != c; s++); 52 | return (*s == c) ? (char *)s : NULL; 53 | } 54 | 55 | char *strcpy(char *dest, const char *src) 56 | { 57 | const char *s = src; 58 | char *d = dest; 59 | while ((*d++ = *s++)); 60 | return dest; 61 | } 62 | 63 | char *strncpy(char *dest, const char *src, size_t n) 64 | { 65 | const char *s = src; 66 | char *d = dest; 67 | while (n-- && (*d++ = *s++)); 68 | return dest; 69 | } 70 | 71 | int strcmp(const char *a, const char *b) 72 | { 73 | while(*a && (*a==*b)) 74 | ++a, ++b; 75 | return *a-*b; 76 | } 77 | -------------------------------------------------------------------------------- /freertos/Makefile: -------------------------------------------------------------------------------- 1 | CROSS_COMPILE=arm-none-eabi- 2 | QEMU_STM32 ?= ../../qemu_stm32/arm-softmmu/qemu-system-arm 3 | 4 | ARCH=CM3 5 | VENDOR=ST 6 | PLAT=STM32F10x 7 | CMSIS_LIB=libraries/CMSIS/$(ARCH) 8 | STM32_LIB=libraries/STM32F10x_StdPeriph_Driver 9 | 10 | CMSIS_PLAT_SRC = $(CMSIS_LIB)/DeviceSupport/$(VENDOR)/$(PLAT) 11 | 12 | FREERTOS_SRC = libraries/FreeRTOS 13 | FREERTOS_INC = $(FREERTOS_SRC)/include/ 14 | FREERTOS_PORT_INC = $(FREERTOS_SRC)/portable/GCC/ARM_$(ARCH)/ 15 | 16 | all: main.bin 17 | 18 | main.bin: main.c 19 | $(CROSS_COMPILE)gcc \ 20 | -Wl,-Tmain.ld -nostartfiles \ 21 | -I. -I$(FREERTOS_INC) -I$(FREERTOS_PORT_INC) \ 22 | -Ilibraries/CMSIS/CM3/CoreSupport \ 23 | -Ilibraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x \ 24 | -Ilibraries/STM32F10x_StdPeriph_Driver/inc \ 25 | -fno-common -O0 \ 26 | -gdwarf-2 -g3 \ 27 | -mcpu=cortex-m3 -mthumb \ 28 | -o main.elf \ 29 | \ 30 | $(CMSIS_LIB)/CoreSupport/core_cm3.c \ 31 | $(CMSIS_PLAT_SRC)/system_stm32f10x.c \ 32 | $(CMSIS_PLAT_SRC)/startup/gcc_ride7/startup_stm32f10x_md.s \ 33 | $(STM32_LIB)/src/stm32f10x_rcc.c \ 34 | $(STM32_LIB)/src/stm32f10x_gpio.c \ 35 | $(STM32_LIB)/src/stm32f10x_usart.c \ 36 | $(STM32_LIB)/src/stm32f10x_exti.c \ 37 | $(STM32_LIB)/src/misc.c \ 38 | \ 39 | $(FREERTOS_SRC)/croutine.c \ 40 | $(FREERTOS_SRC)/list.c \ 41 | $(FREERTOS_SRC)/queue.c \ 42 | $(FREERTOS_SRC)/tasks.c \ 43 | $(FREERTOS_SRC)/portable/GCC/ARM_CM3/port.c \ 44 | $(FREERTOS_SRC)/portable/MemMang/heap_1.c \ 45 | \ 46 | stm32_p103.c \ 47 | main.c 48 | $(CROSS_COMPILE)objcopy -Obinary main.elf main.bin 49 | $(CROSS_COMPILE)objdump -S main.elf > main.list 50 | 51 | qemu: main.bin $(QEMU_STM32) 52 | $(QEMU_STM32) -M stm32-p103 -kernel main.bin 53 | 54 | qemudbg: main.bin $(QEMU_STM32) 55 | $(QEMU_STM32) -M stm32-p103 \ 56 | -gdb tcp::3333 -S \ 57 | -kernel main.bin 58 | 59 | qemuauto: main.bin 60 | bash emulate.sh main.bin 61 | 62 | emu: main.bin 63 | bash emulate.sh main.bin 64 | 65 | clean: 66 | rm -f *.elf *.bin *.list 67 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM9XE/ISR_Support.h: -------------------------------------------------------------------------------- 1 | EXTERN pxCurrentTCB 2 | EXTERN ulCriticalNesting 3 | 4 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5 | ; Context save and restore macro definitions 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | portSAVE_CONTEXT MACRO 9 | 10 | ; Push R0 as we are going to use the register. 11 | STMDB SP!, {R0} 12 | 13 | ; Set R0 to point to the task stack pointer. 14 | STMDB SP, {SP}^ 15 | NOP 16 | SUB SP, SP, #4 17 | LDMIA SP!, {R0} 18 | 19 | ; Push the return address onto the stack. 20 | STMDB R0!, {LR} 21 | 22 | ; Now we have saved LR we can use it instead of R0. 23 | MOV LR, R0 24 | 25 | ; Pop R0 so we can save it onto the system mode stack. 26 | LDMIA SP!, {R0} 27 | 28 | ; Push all the system mode registers onto the task stack. 29 | STMDB LR, {R0-LR}^ 30 | NOP 31 | SUB LR, LR, #60 32 | 33 | ; Push the SPSR onto the task stack. 34 | MRS R0, SPSR 35 | STMDB LR!, {R0} 36 | 37 | LDR R0, =ulCriticalNesting 38 | LDR R0, [R0] 39 | STMDB LR!, {R0} 40 | 41 | ; Store the new top of stack for the task. 42 | LDR R1, =pxCurrentTCB 43 | LDR R0, [R1] 44 | STR LR, [R0] 45 | 46 | ENDM 47 | 48 | 49 | portRESTORE_CONTEXT MACRO 50 | 51 | ; Set the LR to the task stack. 52 | LDR R1, =pxCurrentTCB 53 | LDR R0, [R1] 54 | LDR LR, [R0] 55 | 56 | ; The critical nesting depth is the first item on the stack. 57 | ; Load it into the ulCriticalNesting variable. 58 | LDR R0, =ulCriticalNesting 59 | LDMFD LR!, {R1} 60 | STR R1, [R0] 61 | 62 | ; Get the SPSR from the stack. 63 | LDMFD LR!, {R0} 64 | MSR SPSR_cxsf, R0 65 | 66 | ; Restore all system mode registers for the task. 67 | LDMFD LR, {R0-R14}^ 68 | NOP 69 | 70 | ; Restore the return address. 71 | LDR LR, [LR, #+60] 72 | 73 | ; And return - correcting the offset in the LR to obtain the 74 | ; correct address. 75 | SUBS PC, LR, #4 76 | 77 | ENDM 78 | 79 | -------------------------------------------------------------------------------- /src/host.c: -------------------------------------------------------------------------------- 1 | #include "host.h" 2 | #include 3 | 4 | typedef union param_t{ 5 | int pdInt; 6 | void *pdPtr; 7 | char *pdChrPtr; 8 | } param; 9 | 10 | typedef int hostfunc(va_list); 11 | 12 | typedef struct { 13 | enum HOST_SYSCALL action; 14 | hostfunc *fptr; 15 | } hostcmdlist; 16 | 17 | #define MKHCL(a, n) {.action=a, .fptr=host_ ## n} 18 | 19 | const hostcmdlist hcl[23]={ 20 | [SYS_OPEN] = MKHCL(SYS_OPEN, open), 21 | [SYS_CLOSE] = MKHCL(SYS_CLOSE, close), 22 | [SYS_WRITE] = MKHCL(SYS_WRITE, write), 23 | [SYS_SYSTEM] = MKHCL(SYS_SYSTEM, system), 24 | }; 25 | 26 | /*action will be in r0, and argv in r1*/ 27 | int host_call(enum HOST_SYSCALL action, void *argv) 28 | { 29 | /* For Thumb-2 code use the BKPT instruction instead of SWI. 30 | * Refer to: 31 | * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Bgbjhiea.html 32 | * http://en.wikipedia.org/wiki/ARM_Cortex-M#Cortex-M4 */ 33 | int result; 34 | __asm__( \ 35 | "bkpt 0xAB\n"\ 36 | "nop\n" \ 37 | "bx lr\n"\ 38 | :"=r" (result) ::\ 39 | ); 40 | return result; 41 | } 42 | 43 | int host_system(va_list v1){ 44 | char *tmpChrPtr; 45 | 46 | tmpChrPtr = va_arg(v1, char *); 47 | return host_call(SYS_SYSTEM, (param []){{.pdChrPtr=tmpChrPtr}, {.pdInt=strlen(tmpChrPtr)}}); 48 | } 49 | 50 | int host_open(va_list v1) { 51 | char *tmpChrPtr; 52 | 53 | tmpChrPtr = va_arg(v1, char *); 54 | return host_call(SYS_OPEN, (param []){{.pdChrPtr=tmpChrPtr}, {.pdInt=va_arg(v1, int)}, {.pdInt=strlen(tmpChrPtr)}}); 55 | } 56 | 57 | int host_close(va_list v1) { 58 | return host_call(SYS_CLOSE, (param []){{.pdInt=va_arg(v1, int)}}); 59 | } 60 | 61 | int host_write(va_list v1) { 62 | return host_call(SYS_WRITE, (param []){{.pdInt=va_arg(v1, int)}, {.pdPtr=va_arg(v1, void *)}, {.pdInt=va_arg(v1, int)}}); 63 | } 64 | 65 | int host_action(enum HOST_SYSCALL action, ...) 66 | { 67 | int result; 68 | 69 | va_list v1; 70 | va_start(v1, action); 71 | 72 | result = hcl[action].fptr(v1); 73 | 74 | va_end(v1); 75 | 76 | return result; 77 | } 78 | -------------------------------------------------------------------------------- /freertos/libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /src/dir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "dir.h" 4 | #include "string.h" 5 | #include "hash-djb2.h" 6 | 7 | static dirdef_t dirds[MAX_DIRS]; 8 | static xSemaphoreHandle dir_sem = NULL; 9 | 10 | __attribute__((constructor)) void dir_init() { 11 | memset(dirds, 0, sizeof(dirds)); 12 | dir_sem = xSemaphoreCreateMutex(); 13 | } 14 | 15 | static dirdef_t * dir_getdird(int dird){ 16 | if(dird < 0 || dird >= MAX_DIRS) 17 | return NULL; 18 | else return dirds + dird; 19 | } 20 | 21 | static int dir_is_open_int(int dird){ 22 | dirdef_t * d = dir_getdird(dird); 23 | if(d == NULL)return 0; 24 | else return !((d -> dirnext == NULL) && 25 | (d -> dirclose == NULL) && 26 | (d -> opaque == NULL)); 27 | } 28 | 29 | static int dir_finddird(){ 30 | int i; 31 | for(i = 0; i < MAX_DIRS; ++i){ 32 | if(!dir_is_open(i))return i; 33 | } 34 | return -1; 35 | } 36 | 37 | int dir_is_open(int dird){ 38 | int r; 39 | xSemaphoreTake(dir_sem, portMAX_DELAY); 40 | r = dir_is_open_int(dird); 41 | xSemaphoreGive(dir_sem); 42 | return r; 43 | } 44 | 45 | int dir_open(dirnext_t dirnext, dirclose_t dirclose, void * opaque){ 46 | int dird; 47 | 48 | xSemaphoreTake(dir_sem, portMAX_DELAY); 49 | dird = dir_finddird(); 50 | if(dird > 0){ 51 | dirds[dird].dirnext = dirnext; 52 | dirds[dird].dirclose = dirclose; 53 | dirds[dird].opaque = opaque; 54 | } 55 | xSemaphoreGive(dir_sem); 56 | 57 | return dird; 58 | } 59 | 60 | int dir_next(int dird, void * buf, size_t bufsize){ 61 | if(dir_is_open_int(dird)){ 62 | if(dirds[dird].dirnext){ 63 | return dirds[dird].dirnext(dirds[dird].opaque, buf, bufsize); 64 | }else{ 65 | return ENOTSUPPORT; 66 | } 67 | }else{ 68 | return ENOTOPEN; 69 | } 70 | } 71 | 72 | int dir_close(int dird){ 73 | if(dir_is_open_int(dird)){ 74 | int r = 0; 75 | if(dirds[dird].dirclose){ 76 | r = dirds[dird].dirclose(dirds[dird].opaque); 77 | } 78 | xSemaphoreTake(dir_sem, portMAX_DELAY); 79 | memset(dirds + dird,0,sizeof(dirdef_t)); 80 | xSemaphoreGive(dir_sem); 81 | return r; 82 | }else{ 83 | return ENOTOPEN; 84 | } 85 | } 86 | 87 | void dir_set_opaque(int dird, void * opaque){ 88 | if(dir_is_open_int(dird)) 89 | dirds[dird].opaque = opaque; 90 | 91 | } 92 | 93 | // TODO add dev,romfs's dir* function implementation 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/filesystem.c: -------------------------------------------------------------------------------- 1 | #include "osdebug.h" 2 | #include "filesystem.h" 3 | #include "fio.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #define MAX_FS 16 10 | 11 | struct fs_t { 12 | uint32_t hash; 13 | fs_open_t cb; 14 | fs_open_dir_t dcb; 15 | void * opaque; 16 | }; 17 | 18 | static struct fs_t fss[MAX_FS]; 19 | 20 | __attribute__((constructor)) void fs_init() { 21 | memset(fss, 0, sizeof(fss)); 22 | } 23 | 24 | int register_fs(const char * mountpoint, fs_open_t callback, fs_open_dir_t dir_callback, void * opaque) { 25 | int i; 26 | DBGOUT("register_fs(\"%s\", %p, %p, %p)\r\n", mountpoint, callback, dir_callback, opaque); 27 | 28 | for (i = 0; i < MAX_FS; i++) { 29 | if (!fss[i].cb) { 30 | fss[i].hash = hash_djb2((const uint8_t *) mountpoint, -1); 31 | fss[i].cb = callback; 32 | fss[i].dcb = dir_callback; 33 | fss[i].opaque = opaque; 34 | return 0; 35 | } 36 | } 37 | 38 | return -1; 39 | } 40 | 41 | int fs_open(const char * path, int flags, int mode) { 42 | const char * slash; 43 | uint32_t hash; 44 | int i; 45 | // DBGOUT("fs_open(\"%s\", %i, %i)\r\n", path, flags, mode); 46 | 47 | while (path[0] == '/') 48 | path++; 49 | 50 | slash = strchr(path, '/'); 51 | 52 | if (!slash) 53 | return -2; 54 | 55 | hash = hash_djb2((const uint8_t *) path, slash - path); 56 | path = slash + 1; 57 | 58 | for (i = 0; i < MAX_FS; i++) { 59 | if (fss[i].hash == hash) 60 | return fss[i].cb(fss[i].opaque, path, flags, mode); 61 | } 62 | 63 | return -2; 64 | } 65 | 66 | static int root_opendir(){ 67 | return OPENDIR_NOTFOUNDFS; 68 | } 69 | 70 | int fs_opendir(const char * path){ 71 | const char * slash; 72 | uint32_t hash; 73 | 74 | if ( path[0] == '\0' || (path[0] == '/' && path[1] == '\0') ){ 75 | return root_opendir(); 76 | } 77 | 78 | while (path[0] == '/') 79 | path++; 80 | 81 | slash = strchr(path, '/'); 82 | if (!slash) 83 | slash = path + strlen(path); 84 | 85 | hash = hash_djb2((const uint8_t *) path, slash - path); 86 | 87 | if(*(slash) == '\0'){ 88 | path = ""; 89 | }else{ 90 | path = slash + 1; 91 | } 92 | 93 | for (int i = 0; i < MAX_FS; i++) { 94 | if (fss[i].hash == hash) 95 | return fss[i].dcb(fss[i].opaque, path); 96 | } 97 | 98 | return OPENDIR_NOTFOUNDFS; 99 | } 100 | 101 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TARGET = main 2 | .DEFAULT_GOAL = all 3 | 4 | CROSS_COMPILE ?= arm-none-eabi- 5 | CC := $(CROSS_COMPILE)gcc 6 | CFLAGS = -fno-common -O0 \ 7 | -std=c99 -pedantic \ 8 | -gdwarf-2 -ffreestanding -g3 \ 9 | -mcpu=cortex-m3 -mthumb \ 10 | -Wall -Werror \ 11 | -Tmain.ld -nostartfiles \ 12 | -DUSER_NAME=\"$(USER)\" 13 | 14 | ARCH = CM3 15 | VENDOR = ST 16 | PLAT = STM32F10x 17 | 18 | LIBDIR = . 19 | CODEBASE = freertos 20 | CMSIS_LIB = $(CODEBASE)/libraries/CMSIS/$(ARCH) 21 | STM32_LIB = $(CODEBASE)/libraries/STM32F10x_StdPeriph_Driver 22 | 23 | CMSIS_PLAT_SRC = $(CMSIS_LIB)/DeviceSupport/$(VENDOR)/$(PLAT) 24 | 25 | FREERTOS_SRC = $(CODEBASE)/libraries/FreeRTOS 26 | FREERTOS_INC = $(FREERTOS_SRC)/include/ 27 | FREERTOS_PORT_INC = $(FREERTOS_SRC)/portable/GCC/ARM_$(ARCH)/ 28 | 29 | OUTDIR = build 30 | SRCDIR = src\ 31 | $(CMSIS_LIB)/CoreSupport \ 32 | $(STM32_LIB)/src \ 33 | $(CMSIS_PLAT_SRC) \ 34 | $(FREERTOS_SRC) 35 | INCDIR = include \ 36 | $(CMSIS_LIB)/CoreSupport \ 37 | $(STM32_LIB)/inc \ 38 | $(CMSIS_PLAT_SRC) \ 39 | $(FREERTOS_INC) \ 40 | $(FREERTOS_PORT_INC) 41 | INCLUDES = $(addprefix -I,$(INCDIR)) 42 | DATDIR = data 43 | TOOLDIR = tool 44 | TMPDiR = output 45 | 46 | HEAP_IMPL = heap_ww 47 | SRC = $(wildcard $(addsuffix /*.c,$(SRCDIR))) \ 48 | $(wildcard $(addsuffix /*.s,$(SRCDIR))) \ 49 | $(FREERTOS_SRC)/portable/MemMang/$(HEAP_IMPL).c \ 50 | $(FREERTOS_SRC)/portable/GCC/ARM_CM3/port.c \ 51 | $(CMSIS_PLAT_SRC)/startup/gcc_ride7/startup_stm32f10x_md.s 52 | OBJ := $(addprefix $(OUTDIR)/,$(patsubst %.s,%.o,$(SRC:.c=.o))) 53 | DEP = $(OBJ:.o=.o.d) 54 | DAT = 55 | 56 | MAKDIR = mk 57 | MAK = $(wildcard $(MAKDIR)/*.mk) 58 | 59 | include $(MAK) 60 | 61 | 62 | all: $(OUTDIR)/$(TARGET).bin $(OUTDIR)/$(TARGET).lst 63 | 64 | $(OUTDIR)/$(TARGET).bin: $(OUTDIR)/$(TARGET).elf 65 | @echo " OBJCOPY "$@ 66 | @$(CROSS_COMPILE)objcopy -Obinary $< $@ 67 | 68 | $(OUTDIR)/$(TARGET).lst: $(OUTDIR)/$(TARGET).elf 69 | @echo " LIST "$@ 70 | @$(CROSS_COMPILE)objdump -S $< > $@ 71 | 72 | $(OUTDIR)/$(TARGET).elf: $(OBJ) $(DAT) 73 | @echo " LD "$@ 74 | @echo " MAP "$(OUTDIR)/$(TARGET).map 75 | @$(CROSS_COMPILE)gcc $(CFLAGS) -Wl,-Map=$(OUTDIR)/$(TARGET).map -o $@ $^ 76 | 77 | $(OUTDIR)/%.o: %.c 78 | @mkdir -p $(dir $@) 79 | @echo " CC "$@ 80 | @$(CROSS_COMPILE)gcc $(CFLAGS) -MMD -MF $@.d -o $@ -c $(INCLUDES) $< 81 | 82 | $(OUTDIR)/%.o: %.s 83 | @mkdir -p $(dir $@) 84 | @echo " CC "$@ 85 | @$(CROSS_COMPILE)gcc $(CFLAGS) -MMD -MF $@.d -o $@ -c $(INCLUDES) $< 86 | 87 | clean: 88 | rm -rf $(OUTDIR) $(TMPDIR) 89 | 90 | -include $(DEP) 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /src/romfs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "fio.h" 6 | #include "filesystem.h" 7 | #include "romfs.h" 8 | #include "osdebug.h" 9 | #include "hash-djb2.h" 10 | 11 | struct romfs_fds_t { 12 | const uint8_t * file; 13 | uint32_t cursor; 14 | uint32_t size; 15 | }; 16 | 17 | static struct romfs_fds_t romfs_fds[MAX_FDS]; 18 | 19 | static uint32_t get_unaligned(const uint8_t * d) { 20 | return ((uint32_t) d[0]) | ((uint32_t) (d[1] << 8)) | ((uint32_t) (d[2] << 16)) | ((uint32_t) (d[3] << 24)); 21 | } 22 | 23 | static ssize_t romfs_read(void * opaque, void * buf, size_t count) { 24 | struct romfs_fds_t * f = (struct romfs_fds_t *) opaque; 25 | uint32_t size = f -> size; 26 | 27 | if ((f->cursor + count) > size) 28 | count = size - f->cursor; 29 | 30 | memcpy(buf, f->file + f->cursor, count); 31 | f->cursor += count; 32 | 33 | return count; 34 | } 35 | 36 | static off_t romfs_seek(void * opaque, off_t offset, int whence) { 37 | struct romfs_fds_t * f = (struct romfs_fds_t *) opaque; 38 | uint32_t size = f->size; 39 | uint32_t origin; 40 | 41 | switch (whence) { 42 | case SEEK_SET: 43 | origin = 0; 44 | break; 45 | case SEEK_CUR: 46 | origin = f->cursor; 47 | break; 48 | case SEEK_END: 49 | origin = size; 50 | break; 51 | default: 52 | return -1; 53 | } 54 | 55 | offset = origin + offset; 56 | 57 | if (offset < 0) 58 | return -1; 59 | if (offset > size) 60 | offset = size; 61 | 62 | f->cursor = offset; 63 | 64 | return offset; 65 | } 66 | 67 | const uint8_t * romfs_get_file_by_hash(const uint8_t * romfs, uint32_t h, uint32_t * len) { 68 | const uint8_t * meta; 69 | 70 | for (meta = romfs; get_unaligned(meta) && get_unaligned(meta + 4); meta += get_unaligned(meta + 4) + 12) { 71 | if (get_unaligned(meta) == h) { 72 | if (len) { 73 | *len = get_unaligned(meta + 4); 74 | } 75 | return meta + 12; 76 | } 77 | } 78 | 79 | return NULL; 80 | } 81 | 82 | static int romfs_open(void * opaque, const char * path, int flags, int mode) { 83 | uint32_t h = hash_djb2((const uint8_t *) path, -1); 84 | const uint8_t * romfs = (const uint8_t *) opaque; 85 | const uint8_t * file; 86 | int r = -1; 87 | 88 | file = romfs_get_file_by_hash(romfs, h, NULL); 89 | 90 | if (file) { 91 | r = fio_open(romfs_read, NULL, romfs_seek, NULL, NULL); 92 | if (r > 0) { 93 | uint32_t size = get_unaligned(file - 8); 94 | const uint8_t *filestart = file; 95 | while(*filestart) ++filestart; 96 | ++filestart; 97 | size -= filestart - file; 98 | romfs_fds[r].file = filestart; 99 | romfs_fds[r].cursor = 0; 100 | romfs_fds[r].size = size; 101 | fio_set_opaque(r, romfs_fds + r); 102 | } 103 | } 104 | return r; 105 | } 106 | 107 | void register_romfs(const char * mountpoint, const uint8_t * romfs) { 108 | // DBGOUT("Registering romfs `%s' @ %p\r\n", mountpoint, romfs); 109 | register_fs(mountpoint, romfs_open, NULL, (void *) romfs); 110 | } 111 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.c: -------------------------------------------------------------------------------- 1 | //* ---------------------------------------------------------------------------- 2 | //* ATMEL Microcontroller Software Support - ROUSSET - 3 | //* ---------------------------------------------------------------------------- 4 | //* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 5 | //* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 6 | //* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 7 | //* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 8 | //* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 9 | //* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 10 | //* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 11 | //* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 12 | //* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 13 | //* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | //* ---------------------------------------------------------------------------- 15 | //* File Name : lib_AT91SAM7X256.h 16 | //* Object : AT91SAM7X256 inlined functions 17 | //* Generated : AT91 SW Application Group 05/20/2005 (16:22:29) 18 | //* 19 | //* CVS Reference : /lib_dbgu.h/1.1/Fri Jan 31 12:18:40 2003// 20 | //* CVS Reference : /lib_pmc_SAM7X.h/1.1/Tue Feb 1 08:32:10 2005// 21 | //* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// 22 | //* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// 23 | //* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// 24 | //* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// 25 | //* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// 26 | //* CVS Reference : /lib_spi2.h/1.1/Mon Aug 25 14:23:52 2003// 27 | //* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// 28 | //* CVS Reference : /lib_aic_6075b.h/1.1/Fri May 20 14:01:19 2005// 29 | //* CVS Reference : /lib_aes_6149a.h/1.1/Mon Jan 17 07:43:09 2005// 30 | //* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// 31 | //* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// 32 | //* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// 33 | //* CVS Reference : /lib_udp.h/1.4/Wed Feb 16 08:39:34 2005// 34 | //* CVS Reference : /lib_des3_6150a.h/1.1/Mon Jan 17 09:19:19 2005// 35 | //* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// 36 | //* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// 37 | //* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// 38 | //* CVS Reference : /lib_can_AT91.h/1.4/Fri Oct 17 09:12:50 2003// 39 | //* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// 40 | //* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// 41 | //* ---------------------------------------------------------------------------- 42 | 43 | 44 | #include "AT91SAM7X256.h" 45 | 46 | 47 | //*---------------------------------------------------------------------------- 48 | //* \fn AT91F_AIC_ConfigureIt 49 | //* \brief Interrupt Handler Initialization 50 | //*---------------------------------------------------------------------------- 51 | 52 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Renesas/RX200/port_asm.src: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | .GLB _vSoftwareInterruptISR 54 | .GLB _vSoftwareInterruptEntry 55 | 56 | .SECTION P,CODE 57 | 58 | _vSoftwareInterruptEntry: 59 | 60 | BRA _vSoftwareInterruptISR 61 | 62 | .RVECTOR 27, _vSoftwareInterruptEntry 63 | 64 | .END 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Renesas/RX600/port_asm.src: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | .GLB _vSoftwareInterruptISR 54 | .GLB _vSoftwareInterruptEntry 55 | 56 | .SECTION P,CODE 57 | 58 | _vSoftwareInterruptEntry: 59 | 60 | BRA _vSoftwareInterruptISR 61 | 62 | .RVECTOR 27, _vSoftwareInterruptEntry 63 | 64 | .END 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AVR32_UC3/read.c: -------------------------------------------------------------------------------- 1 | /*This file is prepared for Doxygen automatic documentation generation.*/ 2 | /*! \file ********************************************************************* 3 | * 4 | * \brief System-specific implementation of the \ref __read function used by 5 | the standard library. 6 | * 7 | * - Compiler: IAR EWAVR32 8 | * - Supported devices: All AVR32 devices with a USART module can be used. 9 | * - AppNote: 10 | * 11 | * \author Atmel Corporation: http://www.atmel.com \n 12 | * Support and FAQ: http://support.atmel.no/ 13 | * 14 | ******************************************************************************/ 15 | 16 | /* Copyright (c) 2007, Atmel Corporation All rights reserved. 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted provided that the following conditions are met: 20 | * 21 | * 1. Redistributions of source code must retain the above copyright notice, 22 | * this list of conditions and the following disclaimer. 23 | * 24 | * 2. Redistributions in binary form must reproduce the above copyright notice, 25 | * this list of conditions and the following disclaimer in the documentation 26 | * and/or other materials provided with the distribution. 27 | * 28 | * 3. The name of ATMEL may not be used to endorse or promote products derived 29 | * from this software without specific prior written permission. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED 32 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 33 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND 34 | * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, 35 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 36 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 37 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 38 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 40 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | */ 42 | 43 | 44 | #include 45 | #include 46 | #include "usart.h" 47 | 48 | 49 | _STD_BEGIN 50 | 51 | 52 | #pragma module_name = "?__read" 53 | 54 | 55 | extern volatile avr32_usart_t *volatile stdio_usart_base; 56 | 57 | 58 | /*! \brief Reads a number of bytes, at most \a size, into the memory area 59 | * pointed to by \a buffer. 60 | * 61 | * \param handle File handle to read from. 62 | * \param buffer Pointer to buffer to write read bytes to. 63 | * \param size Number of bytes to read. 64 | * 65 | * \return The number of bytes read, \c 0 at the end of the file, or 66 | * \c _LLIO_ERROR on failure. 67 | */ 68 | size_t __read(int handle, unsigned char *buffer, size_t size) 69 | { 70 | int nChars = 0; 71 | 72 | // This implementation only reads from stdin. 73 | // For all other file handles, it returns failure. 74 | if (handle != _LLIO_STDIN) 75 | { 76 | return _LLIO_ERROR; 77 | } 78 | 79 | for (; size > 0; --size) 80 | { 81 | int c = usart_getchar(stdio_usart_base); 82 | if (c < 0) 83 | break; 84 | 85 | *buffer++ = c; 86 | ++nChars; 87 | } 88 | 89 | return nChars; 90 | } 91 | 92 | 93 | _STD_END 94 | -------------------------------------------------------------------------------- /freertos/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_CONF_H 23 | #define __STM32F10x_CONF_H 24 | 25 | /* Includes ------------------------------------------------------------------*/ 26 | /* Uncomment the line below to enable peripheral header file inclusion */ 27 | /* #include "stm32f10x_adc.h" */ 28 | /* #include "stm32f10x_bkp.h" */ 29 | /* #include "stm32f10x_can.h" */ 30 | /* #include "stm32f10x_cec.h" */ 31 | /* #include "stm32f10x_crc.h" */ 32 | /* #include "stm32f10x_dac.h" */ 33 | /* #include "stm32f10x_dbgmcu.h" */ 34 | /* #include "stm32f10x_dma.h" */ 35 | /* #include "stm32f10x_exti.h" */ 36 | /* #include "stm32f10x_flash.h" */ 37 | /* #include "stm32f10x_fsmc.h" */ 38 | #include "stm32f10x_gpio.h" 39 | /* #include "stm32f10x_i2c.h" */ 40 | /* #include "stm32f10x_iwdg.h" */ 41 | /* #include "stm32f10x_pwr.h" */ 42 | /* #include "stm32f10x_rcc.h" */ 43 | /* #include "stm32f10x_rtc.h" */ 44 | /* #include "stm32f10x_sdio.h" */ 45 | /* #include "stm32f10x_spi.h" */ 46 | /* #include "stm32f10x_tim.h" */ 47 | #include "stm32f10x_usart.h" 48 | /* #include "stm32f10x_wwdg.h" */ 49 | /* #include "misc.h" */ /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 50 | 51 | /* Exported types ------------------------------------------------------------*/ 52 | /* Exported constants --------------------------------------------------------*/ 53 | /* Uncomment the line below to expanse the "assert_param" macro in the 54 | Standard Peripheral Library drivers code */ 55 | /* #define USE_FULL_ASSERT 1 */ 56 | 57 | /* Exported macro ------------------------------------------------------------*/ 58 | #ifdef USE_FULL_ASSERT 59 | 60 | /** 61 | * @brief The assert_param macro is used for function's parameters check. 62 | * @param expr: If expr is false, it calls assert_failed function 63 | * which reports the name of the source file and the source 64 | * line number of the call that failed. 65 | * If expr is true, it returns no value. 66 | * @retval None 67 | */ 68 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 69 | /* Exported functions ------------------------------------------------------- */ 70 | void assert_failed(uint8_t* file, uint32_t line); 71 | #else 72 | #define assert_param(expr) ((void)0) 73 | #endif /* USE_FULL_ASSERT */ 74 | 75 | #endif /* __STM32F10x_CONF_H */ 76 | 77 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /include/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_CONF_H 23 | #define __STM32F10x_CONF_H 24 | 25 | /* Includes ------------------------------------------------------------------*/ 26 | /* Uncomment the line below to enable peripheral header file inclusion */ 27 | /* #include "stm32f10x_adc.h" */ 28 | /* #include "stm32f10x_bkp.h" */ 29 | /* #include "stm32f10x_can.h" */ 30 | /* #include "stm32f10x_cec.h" */ 31 | /* #include "stm32f10x_crc.h" */ 32 | /* #include "stm32f10x_dac.h" */ 33 | /* #include "stm32f10x_dbgmcu.h" */ 34 | /* #include "stm32f10x_dma.h" */ 35 | /* #include "stm32f10x_exti.h" */ 36 | /* #include "stm32f10x_flash.h" */ 37 | /* #include "stm32f10x_fsmc.h" */ 38 | #include "stm32f10x_gpio.h" 39 | /* #include "stm32f10x_i2c.h" */ 40 | /* #include "stm32f10x_iwdg.h" */ 41 | /* #include "stm32f10x_pwr.h" */ 42 | /* #include "stm32f10x_rcc.h" */ 43 | /* #include "stm32f10x_rtc.h" */ 44 | /* #include "stm32f10x_sdio.h" */ 45 | /* #include "stm32f10x_spi.h" */ 46 | /* #include "stm32f10x_tim.h" */ 47 | #include "stm32f10x_usart.h" 48 | /* #include "stm32f10x_wwdg.h" */ 49 | /* #include "misc.h" */ /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 50 | 51 | /* Exported types ------------------------------------------------------------*/ 52 | /* Exported constants --------------------------------------------------------*/ 53 | /* Uncomment the line below to expanse the "assert_param" macro in the 54 | Standard Peripheral Library drivers code */ 55 | /* #define USE_FULL_ASSERT 1 */ 56 | 57 | /* Exported macro ------------------------------------------------------------*/ 58 | #ifdef USE_FULL_ASSERT 59 | 60 | /** 61 | * @brief The assert_param macro is used for function's parameters check. 62 | * @param expr: If expr is false, it calls assert_failed function 63 | * which reports the name of the source file and the source 64 | * line number of the call that failed. 65 | * If expr is true, it returns no value. 66 | * @retval None 67 | */ 68 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 69 | /* Exported functions ------------------------------------------------------- */ 70 | void assert_failed(uint8_t* file, uint32_t line); 71 | #else 72 | #define assert_param(expr) ((void)0) 73 | #endif /* USE_FULL_ASSERT */ 74 | 75 | #endif /* __STM32F10x_CONF_H */ 76 | 77 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_WWDG_H 25 | #define __STM32F10x_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup WWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup WWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup WWDG_Prescaler 55 | * @{ 56 | */ 57 | 58 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 59 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 60 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 61 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 62 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 63 | ((PRESCALER) == WWDG_Prescaler_2) || \ 64 | ((PRESCALER) == WWDG_Prescaler_4) || \ 65 | ((PRESCALER) == WWDG_Prescaler_8)) 66 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 67 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup WWDG_Exported_Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup WWDG_Exported_Functions 85 | * @{ 86 | */ 87 | 88 | void WWDG_DeInit(void); 89 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 90 | void WWDG_SetWindowValue(uint8_t WindowValue); 91 | void WWDG_EnableIT(void); 92 | void WWDG_SetCounter(uint8_t Counter); 93 | void WWDG_Enable(uint8_t Counter); 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F10x_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/CCS/MSP430X/data_model.h: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | 54 | .if $DEFINED( __LARGE_DATA_MODEL__ ) 55 | .define "pushm.a", pushm_x 56 | .define "popm.a", popm_x 57 | .define "push.a", push_x 58 | .define "pop.a", pop_x 59 | .define "mov.a", mov_x 60 | .else 61 | .define "pushm.w", pushm_x 62 | .define "popm.w", popm_x 63 | .define "push.w", push_x 64 | .define "pop.w", pop_x 65 | .define "mov.w", mov_x 66 | .endif 67 | 68 | .if $DEFINED( __LARGE_CODE_MODEL__ ) 69 | .define "calla", call_x 70 | .define "reta", ret_x 71 | .else 72 | .define "call", call_x 73 | .define "ret", ret_x 74 | .endif 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AVR32_UC3/write.c: -------------------------------------------------------------------------------- 1 | /*This file is prepared for Doxygen automatic documentation generation.*/ 2 | /*! \file ********************************************************************* 3 | * 4 | * \brief System-specific implementation of the \ref __write function used by 5 | the standard library. 6 | * 7 | * - Compiler: IAR EWAVR32 8 | * - Supported devices: All AVR32 devices with a USART module can be used. 9 | * - AppNote: 10 | * 11 | * \author Atmel Corporation: http://www.atmel.com \n 12 | * Support and FAQ: http://support.atmel.no/ 13 | * 14 | ******************************************************************************/ 15 | 16 | /* Copyright (c) 2007, Atmel Corporation All rights reserved. 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted provided that the following conditions are met: 20 | * 21 | * 1. Redistributions of source code must retain the above copyright notice, 22 | * this list of conditions and the following disclaimer. 23 | * 24 | * 2. Redistributions in binary form must reproduce the above copyright notice, 25 | * this list of conditions and the following disclaimer in the documentation 26 | * and/or other materials provided with the distribution. 27 | * 28 | * 3. The name of ATMEL may not be used to endorse or promote products derived 29 | * from this software without specific prior written permission. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED 32 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 33 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND 34 | * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, 35 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 36 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 37 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 38 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 40 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | */ 42 | 43 | 44 | #include 45 | #include 46 | #include "usart.h" 47 | 48 | 49 | _STD_BEGIN 50 | 51 | 52 | #pragma module_name = "?__write" 53 | 54 | 55 | //! Pointer to the base of the USART module instance to use for stdio. 56 | __no_init volatile avr32_usart_t *volatile stdio_usart_base; 57 | 58 | 59 | /*! \brief Writes a number of bytes, at most \a size, from the memory area 60 | * pointed to by \a buffer. 61 | * 62 | * If \a buffer is zero then \ref __write performs flushing of internal buffers, 63 | * if any. In this case, \a handle can be \c -1 to indicate that all handles 64 | * should be flushed. 65 | * 66 | * \param handle File handle to write to. 67 | * \param buffer Pointer to buffer to read bytes to write from. 68 | * \param size Number of bytes to write. 69 | * 70 | * \return The number of bytes written, or \c _LLIO_ERROR on failure. 71 | */ 72 | size_t __write(int handle, const unsigned char *buffer, size_t size) 73 | { 74 | size_t nChars = 0; 75 | 76 | if (buffer == 0) 77 | { 78 | // This means that we should flush internal buffers. 79 | return 0; 80 | } 81 | 82 | // This implementation only writes to stdout and stderr. 83 | // For all other file handles, it returns failure. 84 | if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR) 85 | { 86 | return _LLIO_ERROR; 87 | } 88 | 89 | for (; size != 0; --size) 90 | { 91 | if (usart_putchar(stdio_usart_base, *buffer++) < 0) 92 | { 93 | return _LLIO_ERROR; 94 | } 95 | 96 | ++nChars; 97 | } 98 | 99 | return nChars; 100 | } 101 | 102 | 103 | _STD_END 104 | -------------------------------------------------------------------------------- /src/clib.c: -------------------------------------------------------------------------------- 1 | #include "fio.h" 2 | #include 3 | #include "clib.h" 4 | 5 | void send_byte(char ); 6 | 7 | size_t fio_printf(int fd, const char *format, ...){ 8 | int i,count=0; 9 | 10 | va_list(v1); 11 | va_start(v1, format); 12 | 13 | int tmpint; 14 | char *tmpcharp; 15 | 16 | for(i=0; format[i]; ++i){ 17 | if(format[i]=='%'){ 18 | switch(format[i+1]){ 19 | case '%': 20 | send_byte('%'); break; 21 | case 'd': 22 | case 'x': 23 | case 'X': 24 | tmpint = va_arg(v1, int); 25 | tmpcharp = itoa(format[i+1]=='x'?"0123456789abcdef":"0123456789ABCDEF", tmpint, format[i+1]=='d'?10: 16); 26 | fio_write(fd, tmpcharp, strlen(tmpcharp)); 27 | break; 28 | case 's': 29 | tmpcharp = va_arg(v1, char *); 30 | fio_write(fd, tmpcharp, strlen(tmpcharp)); 31 | break; 32 | } 33 | /* Skip the next character */ 34 | ++i; 35 | }else 36 | fio_write(fd, format+i, 1); 37 | } 38 | 39 | va_end(v1); 40 | return count; 41 | } 42 | 43 | int sprintf(char *dest, const char *format, ...){ 44 | int i,count=0, p; 45 | 46 | va_list(v1); 47 | va_start(v1, format); 48 | 49 | int tmpint; 50 | char *tmpcharp; 51 | char tmpchar; 52 | 53 | for(i=0, p=0; format[i]; ++i){ 54 | if(format[i]=='%'){ 55 | switch(format[i+1]){ 56 | case '%': 57 | dest[p++]='%'; break; 58 | case 'd': 59 | case 'x': 60 | case 'X': 61 | case 'u': 62 | tmpint = va_arg(v1, int); 63 | if(format[i+1]=='u') 64 | tmpcharp = utoa(format[i+1]=='X'?"0123456789ABCDEF":"0123456789abcdef" ,(unsigned)tmpint, 10); 65 | else 66 | tmpcharp = itoa(format[i+1]=='X'?"0123456789ABCDEF":"0123456789abcdef", tmpint, format[i+1]=='d'?10: 16); 67 | //fio_write(fd, tmpcharp, 3);i 68 | for(;*tmpcharp;++tmpcharp, ++p) 69 | dest[p]=*tmpcharp; 70 | break; 71 | case 's': 72 | tmpcharp = va_arg(v1, char *); 73 | for(;*tmpcharp;++tmpcharp, ++p) 74 | dest[p]=*tmpcharp; 75 | break; 76 | case 'c': 77 | tmpchar = va_arg(v1, int); 78 | dest[p++]=tmpchar; 79 | break; 80 | } 81 | /* Skip the next character */ 82 | ++i; 83 | }else 84 | dest[p++]=format[i]; 85 | } 86 | 87 | va_end(v1); 88 | dest[p]='\0'; 89 | return count; 90 | } 91 | 92 | 93 | size_t strlen(const char *str){ 94 | size_t count; 95 | for(count=0;*str;++count, ++str); 96 | return count; 97 | } 98 | 99 | char *strcat(char * restrict dest, const char * restrict source){ 100 | /* locate '\0' in dest */ 101 | for(;*dest;++dest); 102 | /* copy character from source */ 103 | for(;*source; ++dest, ++source) 104 | *dest=*source; 105 | *dest='\0'; 106 | return dest; 107 | } 108 | 109 | char *itoa(const char *numbox, int num, unsigned int base){ 110 | static char buf[32]={0}; 111 | int i; 112 | if(num==0){ 113 | buf[30]='0'; 114 | return &buf[30]; 115 | } 116 | int negative=(num<0); 117 | if(negative) num=-num; 118 | for(i=30; i>=0&# --i, num/=base) 119 | buf[i] = numbox[num % base]; 120 | if(negative){ 121 | buf[i]='-'; 122 | --i; 123 | } 124 | return buf+i+1; 125 | } 126 | 127 | char *utoa(const char *numbox, unsigned int num, unsigned int base){ 128 | static char buf[32]={0}; 129 | int i; 130 | if(num==0){ 131 | buf[30]='0'; 132 | return &buf[30]; 133 | } 134 | for(i=30; i>=0&# --i, num/=base) 135 | buf[i] = numbox [num % base]; 136 | return buf+i+1; 137 | } 138 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x_crc.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup CRC 30 | * @brief CRC driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup CRC_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup CRC_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Private_Macros 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Private_Variables 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Private_FunctionPrototypes 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup CRC_Private_Functions 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Resets the CRC Data register (DR). 80 | * @param None 81 | * @retval None 82 | */ 83 | void CRC_ResetDR(void) 84 | { 85 | /* Reset CRC generator */ 86 | CRC->CR = CRC_CR_RESET; 87 | } 88 | 89 | /** 90 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 91 | * @param Data: data word(32-bit) to compute its CRC 92 | * @retval 32-bit CRC 93 | */ 94 | uint32_t CRC_CalcCRC(uint32_t Data) 95 | { 96 | CRC->DR = Data; 97 | 98 | return (CRC->DR); 99 | } 100 | 101 | /** 102 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 103 | * @param pBuffer: pointer to the buffer containing the data to be computed 104 | * @param BufferLength: length of the buffer to be computed 105 | * @retval 32-bit CRC 106 | */ 107 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 108 | { 109 | uint32_t index = 0; 110 | 111 | for(index = 0; index < BufferLength; index++) 112 | { 113 | CRC->DR = pBuffer[index]; 114 | } 115 | return (CRC->DR); 116 | } 117 | 118 | /** 119 | * @brief Returns the current CRC value. 120 | * @param None 121 | * @retval 32-bit CRC 122 | */ 123 | uint32_t CRC_GetCRC(void) 124 | { 125 | return (CRC->DR); 126 | } 127 | 128 | /** 129 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 130 | * @param IDValue: 8-bit value to be stored in the ID register 131 | * @retval None 132 | */ 133 | void CRC_SetIDRegister(uint8_t IDValue) 134 | { 135 | CRC->IDR = IDValue; 136 | } 137 | 138 | /** 139 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 140 | * @param None 141 | * @retval 8-bit value of the ID register 142 | */ 143 | uint8_t CRC_GetIDRegister(void) 144 | { 145 | return (CRC->IDR); 146 | } 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 161 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_DBGMCU_H 25 | #define __STM32F10x_DBGMCU_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup DBGMCU 39 | * @{ 40 | */ 41 | 42 | /** @defgroup DBGMCU_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup DBGMCU_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 55 | #define DBGMCU_STOP ((uint32_t)0x00000002) 56 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 57 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 58 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 59 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 60 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 61 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 62 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 63 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 66 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 67 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 68 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 69 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 70 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 71 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 72 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 73 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 74 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 75 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 76 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 77 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 78 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 79 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 80 | 81 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup DBGMCU_Exported_Macros 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup DBGMCU_Exported_Functions 95 | * @{ 96 | */ 97 | 98 | uint32_t DBGMCU_GetREVID(void); 99 | uint32_t DBGMCU_GetDEVID(void); 100 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* __STM32F10x_DBGMCU_H */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Renesas/SH2A_FPU/ISR_Support.inc: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | .macro portSAVE_CONTEXT 54 | 55 | ; Save r0 to r14 and pr. 56 | movml.l r15, @-r15 57 | 58 | ; Save mac1, mach and gbr 59 | sts.l macl, @-r15 60 | sts.l mach, @-r15 61 | stc.l gbr, @-r15 62 | 63 | ; Get the address of pxCurrentTCB 64 | mov.l #_pxCurrentTCB, r0 65 | 66 | ; Get the address of pxTopOfStack from the TCB. 67 | mov.l @r0, r0 68 | 69 | ; Save the stack pointer in pxTopOfStack. 70 | mov.l r15, @r0 71 | 72 | .endm 73 | 74 | ;----------------------------------------------------------- 75 | 76 | .macro portRESTORE_CONTEXT 77 | 78 | ; Get the address of the pxCurrentTCB variable. 79 | mov.l #_pxCurrentTCB, r0 80 | 81 | ; Get the address of the task stack from pxCurrentTCB. 82 | mov.l @r0, r0 83 | 84 | ; Get the task stack itself into the stack pointer. 85 | mov.l @r0, r15 86 | 87 | ; Restore system registers. 88 | ldc.l @r15+, gbr 89 | lds.l @r15+, mach 90 | lds.l @r15+, macl 91 | 92 | ; Restore r0 to r14 and PR 93 | movml.l @r15+, r15 94 | 95 | ; Pop the SR and PC to jump to the start of the task. 96 | rte 97 | nop 98 | 99 | .endm 100 | ;----------------------------------------------------------- -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/STR75x/portasm.s79: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | 54 | RSEG ICODE:CODE 55 | CODE32 56 | 57 | EXTERN vPortPreemptiveTick 58 | EXTERN vTaskSwitchContext 59 | 60 | PUBLIC vPortYieldProcessor 61 | PUBLIC vPortStartFirstTask 62 | 63 | #include "ISR_Support.h" 64 | 65 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 66 | ; Starting the first task is just a matter of restoring the context that 67 | ; was created by pxPortInitialiseStack(). 68 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 69 | vPortStartFirstTask: 70 | portRESTORE_CONTEXT 71 | 72 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 73 | ; Manual context switch function. This is the SWI hander. 74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 75 | vPortYieldProcessor: 76 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 77 | ; as if the context was saved during and IRQ 78 | ; handler. 79 | 80 | portSAVE_CONTEXT ; Save the context of the current task... 81 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 82 | mov lr, pc 83 | BX R0 84 | portRESTORE_CONTEXT ; Restore the context of the selected task. 85 | 86 | 87 | 88 | END 89 | 90 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_IWDG_H 25 | #define __STM32F10x_IWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup IWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup IWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup IWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup IWDG_WriteAccess 55 | * @{ 56 | */ 57 | 58 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 59 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 60 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 61 | ((ACCESS) == IWDG_WriteAccess_Disable)) 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup IWDG_prescaler 67 | * @{ 68 | */ 69 | 70 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 71 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 72 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 73 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 74 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 75 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 76 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 77 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 78 | ((PRESCALER) == IWDG_Prescaler_8) || \ 79 | ((PRESCALER) == IWDG_Prescaler_16) || \ 80 | ((PRESCALER) == IWDG_Prescaler_32) || \ 81 | ((PRESCALER) == IWDG_Prescaler_64) || \ 82 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 83 | ((PRESCALER) == IWDG_Prescaler_256)) 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup IWDG_Flag 89 | * @{ 90 | */ 91 | 92 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 93 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 94 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 95 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup IWDG_Exported_Macros 105 | * @{ 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup IWDG_Exported_Functions 113 | * @{ 114 | */ 115 | 116 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 117 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 118 | void IWDG_SetReload(uint16_t Reload); 119 | void IWDG_ReloadCounter(void); 120 | void IWDG_Enable(void); 121 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* __STM32F10x_IWDG_H */ 128 | /** 129 | * @} 130 | */ 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 141 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_RTC_H 25 | #define __STM32F10x_RTC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup RTC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup RTC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup RTC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup RTC_interrupts_define 55 | * @{ 56 | */ 57 | 58 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 59 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 60 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 61 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 62 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 63 | ((IT) == RTC_IT_SEC)) 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup RTC_interrupts_flags 69 | * @{ 70 | */ 71 | 72 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 73 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 74 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 75 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 76 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 77 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 78 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 79 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 80 | ((FLAG) == RTC_FLAG_SEC)) 81 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup RTC_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup RTC_Exported_Functions 100 | * @{ 101 | */ 102 | 103 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 104 | void RTC_EnterConfigMode(void); 105 | void RTC_ExitConfigMode(void); 106 | uint32_t RTC_GetCounter(void); 107 | void RTC_SetCounter(uint32_t CounterValue); 108 | void RTC_SetPrescaler(uint32_t PrescalerValue); 109 | void RTC_SetAlarm(uint32_t AlarmValue); 110 | uint32_t RTC_GetDivider(void); 111 | void RTC_WaitForLastTask(void); 112 | void RTC_WaitForSynchro(void); 113 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 114 | void RTC_ClearFlag(uint16_t RTC_FLAG); 115 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 116 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __STM32F10x_RTC_H */ 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 136 | -------------------------------------------------------------------------------- /src/mmtest.c: -------------------------------------------------------------------------------- 1 | #include "FreeRTOS.h" 2 | #include "fio.h" 3 | #include "clib.h" 4 | 5 | /* heap_XX.c */ 6 | void *pvPortMalloc(size_t xWantedSize); 7 | void vPortFree(void *pv); 8 | size_t xPortGetFreeHeapSize(void); 9 | 10 | struct slot { 11 | void *pointer; 12 | unsigned int size; 13 | unsigned int lfsr; 14 | }; 15 | 16 | #define CIRCBUFSIZE 5000 17 | unsigned int write_pointer, read_pointer; 18 | static struct slot slots[CIRCBUFSIZE]; 19 | static unsigned int lfsr = 0xACE1; 20 | 21 | 22 | static unsigned int circbuf_size(void) 23 | { 24 | return (write_pointer + CIRCBUFSIZE - read_pointer) % CIRCBUFSIZE; 25 | } 26 | 27 | static void write_cb(struct slot foo) 28 | { 29 | if (circbuf_size() == CIRCBUFSIZE - 1) { 30 | fio_printf(2, "\r\ncircular buffer overflow\r\n"); 31 | //exit(1); 32 | } 33 | slots[write_pointer++] = foo; 34 | write_pointer %= CIRCBUFSIZE; 35 | } 36 | 37 | static struct slot read_cb(void) 38 | { 39 | struct slot foo; 40 | if (write_pointer == read_pointer) { 41 | // circular buffer is empty 42 | return (struct slot){ .pointer=NULL, .size=0, .lfsr=0 }; 43 | } 44 | foo = slots[read_pointer++]; 45 | read_pointer %= CIRCBUFSIZE; 46 | return foo; 47 | } 48 | 49 | 50 | // Get a pseudorandom number generator from Wikipedia 51 | static int prng(void) __attribute__((naked)); 52 | static int prng(void){ 53 | 54 | /*static unsigned int bit; 55 | // taps: 16 14 13 11; characteristic polynomial: x^16 + x^14 + x^13 + x^11 + 1 56 | bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 5) ) & 1; 57 | lfsr = (lfsr >> 1) | (bit << 15);*/ 58 | //return lfsr & 0xffff; 59 | 60 | /* ASM Impletation 61 | movt r3, higer 16 bits of &lfsr 62 | movw r3, lower 16 bits of &lfsr 63 | ;r3=*r3 == lfsr 64 | ldr r3, [r3, #0] 65 | ;r2 = r3 >> 2 66 | mov.w r2, r3, lsr #2 67 | 68 | movt r3, higer 16 bits of &lfsr 69 | movw r3, lower 16 bits of &lfsr 70 | ldr r3, [r3, #0] 71 | (lfsr >> 0) ^ (lfsr >> 2) 72 | eors r2, r3 73 | ... 74 | */ 75 | 76 | 77 | __asm__ ( 78 | "mov r0, %1\t\n" // r0 = lfsr 79 | "eor r3, r3\t\n" // r3 = 0 80 | "eor r3, r0\t\n" // r3 ^= lfsr 81 | "mov r2, r0, lsr #2\t\n" 82 | "eor r3, r2\t\n" // r3 ^= lfsr>>2 83 | "mov r2, r0, lsr #3\t\n" 84 | "eor r3, r2\t\n" // r3 ^= lfsr>>3 85 | "mov r2, r0, lsr #5\t\n" 86 | "eor r3, r2\t\n" // r3 ^= lfsr>>5 87 | "and r3, #0x1\t\n" //bit = r3 & 1 88 | "mov r3, r3, lsl #15\t\n" //r3=bit<<15 89 | "mov r2, r0, lsr #1\t\n" // r2= lfsr>>1 90 | "orr r2, r3\t\n" 91 | "mov %0, r2\t\n" 92 | "mov r0, r2, lsl #16\t\n" // r0 = lfsr(r2) & 0xFFFF 93 | "mov r0, r0, lsr #16\t\n" 94 | : "=r" (lfsr) 95 | : "r" (lfsr) 96 | : "r2", "r0"); 97 | 98 | __asm__("bx lr\t\n"); 99 | 100 | return 0; 101 | } 102 | 103 | 104 | void mmtest_command(int n, char *argv[]){ 105 | int i, size; 106 | char *p; 107 | 108 | fio_printf(2, "\r\n"); 109 | while (1) { 110 | size = prng() & 0x7FF; 111 | fio_printf(1, "try to allocate %d bytes\r\n", size); 112 | p = (char *) pvPortMalloc(size); 113 | fio_printf(1, "malloc returned 0x%x\r\n", p); 114 | if (p == NULL) { 115 | // can't do new allocations until we free some older ones 116 | while (circbuf_size() > 0) { 117 | // confirm that data didn't get trampled before freeing 118 | struct slot foo = read_cb(); 119 | p = foo.pointer; 120 | lfsr = foo.lfsr; // reset the PRNG to its earlier state 121 | size = foo.size; 122 | fio_printf(1, "free a block, size %d\r\n", size); 123 | for (i = 0; i < size; i++) { 124 | unsigned char u = p[i]; 125 | unsigned char v = (unsigned char) prng(); 126 | if (u != v) { 127 | fio_printf(1, "OUCH: u=%x, v=%x\r\n", u, v); 128 | return ; 129 | } 130 | } 131 | vPortFree(p); 132 | if ((prng() & 1) == 0) break; 133 | } 134 | } else { 135 | fio_printf(1, "allocate a block, size %d\r\n", size); 136 | write_cb((struct slot){.pointer=p, .size=size, .lfsr=lfsr}); 137 | for (i = 0; i < size; i++) { 138 | p[i] = (unsigned char) prng(); 139 | } 140 | } 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | #ifndef PROJDEFS_H 68 | #define PROJDEFS_H 69 | 70 | /* Defines the prototype to which task functions must conform. */ 71 | typedef void (*pdTASK_CODE)( void * ); 72 | 73 | #define pdTRUE ( 1 ) 74 | #define pdFALSE ( 0 ) 75 | 76 | #define pdPASS ( 1 ) 77 | #define pdFAIL ( 0 ) 78 | #define errQUEUE_EMPTY ( 0 ) 79 | #define errQUEUE_FULL ( 0 ) 80 | 81 | /* Error definitions. */ 82 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 83 | #define errNO_TASK_TO_RUN ( -2 ) 84 | #define errQUEUE_BLOCKED ( -4 ) 85 | #define errQUEUE_YIELD ( -5 ) 86 | 87 | #endif /* PROJDEFS_H */ 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /tool/mkromfs.c: -------------------------------------------------------------------------------- 1 | #ifdef _WIN32 2 | #include 3 | #endif 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #define hash_init 5381 12 | 13 | uint32_t hash_djb2(const uint8_t * str, uint32_t hash) { 14 | int c; 15 | 16 | while ((c = *str++)) 17 | hash = ((hash << 5) + hash) ^ c; 18 | 19 | return hash; 20 | } 21 | 22 | void usage(const char * binname) { 23 | printf("Usage: %s [-d ] [outfile]\n", binname); 24 | exit(-1); 25 | } 26 | 27 | void processdir(DIR * dirp, const char * curpath, FILE * outfile, const char * prefix) { 28 | char fullpath[1024]; 29 | char buf[16 * 1024]; 30 | struct dirent * ent; 31 | DIR * rec_dirp; 32 | uint32_t cur_hash = hash_djb2((const uint8_t *) curpath, hash_init); 33 | uint32_t size, w, hash,hash_path; 34 | uint8_t b; 35 | FILE * infile; 36 | 37 | while ((ent = readdir(dirp))) { 38 | strcpy(fullpath, prefix); 39 | strcat(fullpath, "/"); 40 | strcat(fullpath, curpath); 41 | strcat(fullpath, ent->d_name); 42 | #ifdef _WIN32 43 | if (GetFileAttributes(fullpath) & FILE_ATTRIBUTE_DIRECTORY) { 44 | #else 45 | if (ent->d_type == DT_DIR) { 46 | #endif 47 | if (strcmp(ent->d_name, ".") == 0) 48 | continue; 49 | if (strcmp(ent->d_name, "..") == 0) 50 | continue; 51 | strcat(fullpath, "/"); 52 | rec_dirp = opendir(fullpath); 53 | processdir(rec_dirp, fullpath + strlen(prefix) + 1, outfile, prefix); 54 | closedir(rec_dirp); 55 | } else { 56 | hash = hash_djb2((const uint8_t *) ent->d_name, cur_hash); 57 | hash_path = hash_djb2((const uint8_t *) curpath, cur_hash); 58 | infile = fopen(fullpath, "rb"); 59 | if (!infile) { 60 | perror("opening input file"); 61 | exit(-1); 62 | } 63 | b = (hash >> 0) & 0xff; fwrite(&b, 1, 1, outfile); 64 | b = (hash >> 8) & 0xff; fwrite(&b, 1, 1, outfile); 65 | b = (hash >> 16) & 0xff; fwrite(&b, 1, 1, outfile); 66 | b = (hash >> 24) & 0xff; fwrite(&b, 1, 1, outfile); 67 | fseek(infile, 0, SEEK_END); 68 | size = ftell(infile) + strlen(ent->d_name) + 1; 69 | fseek(infile, 0, SEEK_SET); 70 | b = (size >> 0) & 0xff; fwrite(&b, 1, 1, outfile); 71 | b = (size >> 8) & 0xff; fwrite(&b, 1, 1, outfile); 72 | b = (size >> 16) & 0xff; fwrite(&b, 1, 1, outfile); 73 | b = (size >> 24) & 0xff; fwrite(&b, 1, 1, outfile); 74 | b = (hash_path >> 0) & 0xff; fwrite(&b, 1, 1, outfile); 75 | b = (hash_path >> 8) & 0xff; fwrite(&b, 1, 1, outfile); 76 | b = (hash_path >> 16) & 0xff; fwrite(&b, 1, 1, outfile); 77 | b = (hash_path >> 24) & 0xff; fwrite(&b, 1, 1, outfile); 78 | fwrite(ent->d_name,strlen(ent->d_name),1,outfile); 79 | b = 0;fwrite(&b,1,1,outfile); 80 | size = size - strlen(ent->d_name) - 1; 81 | while (size) { 82 | w = size > 16 * 1024 ? 16 * 1024 : size; 83 | fread(buf, 1, w, infile); 84 | fwrite(buf, 1, w, outfile); 85 | size -= w; 86 | } 87 | fclose(infile); 88 | } 89 | } 90 | } 91 | 92 | int main(int argc, char ** argv) { 93 | char * binname = *argv++; 94 | char * o; 95 | char * outname = NULL; 96 | char * dirname = "."; 97 | uint64_t z = 0; 98 | FILE * outfile; 99 | DIR * dirp; 100 | 101 | while ((o = *argv++)) { 102 | if (*o == '-') { 103 | o++; 104 | switch (*o) { 105 | case 'd': 106 | dirname = *argv++; 107 | break; 108 | default: 109 | usage(binname); 110 | break; 111 | } 112 | } else { 113 | if (outname) 114 | usage(binname); 115 | outname = o; 116 | } 117 | } 118 | 119 | if (!outname) 120 | outfile = stdout; 121 | else 122 | outfile = fopen(outname, "wb"); 123 | 124 | if (!outfile) { 125 | perror("opening output file"); 126 | exit(-1); 127 | } 128 | 129 | dirp = opendir(dirname); 130 | if (!dirp) { 131 | perror("opening directory"); 132 | exit(-1); 133 | } 134 | 135 | processdir(dirp, "", outfile, dirname); 136 | fwrite(&z, 1, 8, outfile); 137 | if (outname) 138 | fclose(outfile); 139 | closedir(dirp); 140 | 141 | return 0; 142 | } 143 | -------------------------------------------------------------------------------- /src/stm32_p103.c: -------------------------------------------------------------------------------- 1 | #include "stm32_p103.h" 2 | #include "stm32f10x.h" 3 | #include "stm32f10x_gpio.h" 4 | #include "stm32f10x_rcc.h" 5 | #include "stm32f10x_usart.h" 6 | #include "stm32f10x_exti.h" 7 | #include "misc.h" 8 | 9 | void init_led(void) 10 | { 11 | GPIO_InitTypeDef GPIO_InitStructure; 12 | 13 | /* Enable GPIO C clock. */ 14 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); 15 | 16 | /* Set the LED pin state such that the LED is off. The LED is connected 17 | * between power and the microcontroller pin, which makes it turn on when 18 | * the pin is low. 19 | */ 20 | GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_SET); 21 | 22 | /* Configure the LED pin as push-pull output. */ 23 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; 24 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 25 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 26 | GPIO_Init(GPIOC, &GPIO_InitStructure); 27 | } 28 | 29 | void init_button(void) 30 | { 31 | GPIO_InitTypeDef GPIO_InitStructure; 32 | 33 | /* Enable GPIO A clock */ 34 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); 35 | 36 | /* Configure the button pin as a floating input. */ 37 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; 38 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 39 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 40 | GPIO_Init(GPIOC, &GPIO_InitStructure); 41 | } 42 | 43 | void enable_button_interrupts(void) 44 | { 45 | EXTI_InitTypeDef EXTI_InitStructure; 46 | NVIC_InitTypeDef NVIC_InitStructure; 47 | 48 | /* Enable the AFIO clock. GPIO_EXTILineConfig sets registers in 49 | * the AFIO. 50 | */ 51 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); 52 | 53 | /* Connect EXTI Line 0 to the button GPIO Pin */ 54 | GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0); 55 | 56 | /* Configure the EXTI line to generate an interrupt when the button is 57 | * pressed. The button pin is high when pressed, so it needs to trigger 58 | * when rising from low to high. */ 59 | EXTI_InitStructure.EXTI_Line = EXTI_Line0; 60 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; 61 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 62 | EXTI_InitStructure.EXTI_LineCmd = ENABLE; 63 | EXTI_Init(&EXTI_InitStructure); 64 | 65 | /* Enable and set Button EXTI Interrupt to the lowest priority */ 66 | NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; 67 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; 68 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; 69 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 70 | NVIC_Init(&NVIC_InitStructure); 71 | } 72 | 73 | void init_rs232(void) 74 | { 75 | USART_InitTypeDef USART_InitStructure; 76 | GPIO_InitTypeDef GPIO_InitStructure; 77 | 78 | /* Enable peripheral clocks. */ 79 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE); 80 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); 81 | 82 | /* Configure USART2 Rx pin as floating input. */ 83 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; 84 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 85 | GPIO_Init(GPIOA, &GPIO_InitStructure); 86 | 87 | /* Configure USART2 Tx as alternate function push-pull. */ 88 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; 89 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 90 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 91 | GPIO_Init(GPIOA, &GPIO_InitStructure); 92 | 93 | /* Configure the USART2 */ 94 | USART_InitStructure.USART_BaudRate = 9600; 95 | USART_InitStructure.USART_WordLength = USART_WordLength_8b; 96 | USART_InitStructure.USART_StopBits = USART_StopBits_1; 97 | USART_InitStructure.USART_Parity = USART_Parity_No; 98 | USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; 99 | USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; 100 | USART_Init(USART2, &USART_InitStructure); 101 | USART_Cmd(USART2, ENABLE); 102 | } 103 | 104 | void enable_rs232_interrupts(void) 105 | { 106 | NVIC_InitTypeDef NVIC_InitStructure; 107 | 108 | /* Enable transmit and receive interrupts for the USART2. */ 109 | USART_ITConfig(USART2, USART_IT_TXE, DISABLE); 110 | USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); 111 | 112 | /* Enable the USART2 IRQ in the NVIC module (so that the USART2 interrupt 113 | * handler is enabled). */ 114 | NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn; 115 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; 116 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 117 | NVIC_Init(&NVIC_InitStructure); 118 | } 119 | 120 | void enable_rs232(void) 121 | { 122 | /* Enable the RS232 port. */ 123 | USART_Cmd(USART2, ENABLE); 124 | } 125 | -------------------------------------------------------------------------------- /freertos/stm32_p103.c: -------------------------------------------------------------------------------- 1 | #include "stm32_p103.h" 2 | #include "stm32f10x.h" 3 | #include "stm32f10x_gpio.h" 4 | #include "stm32f10x_rcc.h" 5 | #include "stm32f10x_usart.h" 6 | #include "stm32f10x_exti.h" 7 | #include "misc.h" 8 | 9 | void init_led(void) 10 | { 11 | GPIO_InitTypeDef GPIO_InitStructure; 12 | 13 | /* Enable GPIO C clock. */ 14 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); 15 | 16 | /* Set the LED pin state such that the LED is off. The LED is connected 17 | * between power and the microcontroller pin, which makes it turn on when 18 | * the pin is low. 19 | */ 20 | GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_SET); 21 | 22 | /* Configure the LED pin as push-pull output. */ 23 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; 24 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 25 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 26 | GPIO_Init(GPIOC, &GPIO_InitStructure); 27 | } 28 | 29 | void init_button(void) 30 | { 31 | GPIO_InitTypeDef GPIO_InitStructure; 32 | 33 | /* Enable GPIO A clock */ 34 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); 35 | 36 | /* Configure the button pin as a floating input. */ 37 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; 38 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 39 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 40 | GPIO_Init(GPIOC, &GPIO_InitStructure); 41 | } 42 | 43 | void enable_button_interrupts(void) 44 | { 45 | EXTI_InitTypeDef EXTI_InitStructure; 46 | NVIC_InitTypeDef NVIC_InitStructure; 47 | 48 | /* Enable the AFIO clock. GPIO_EXTILineConfig sets registers in 49 | * the AFIO. 50 | */ 51 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); 52 | 53 | /* Connect EXTI Line 0 to the button GPIO Pin */ 54 | GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0); 55 | 56 | /* Configure the EXTI line to generate an interrupt when the button is 57 | * pressed. The button pin is high when pressed, so it needs to trigger 58 | * when rising from low to high. */ 59 | EXTI_InitStructure.EXTI_Line = EXTI_Line0; 60 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; 61 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 62 | EXTI_InitStructure.EXTI_LineCmd = ENABLE; 63 | EXTI_Init(&EXTI_InitStructure); 64 | 65 | /* Enable and set Button EXTI Interrupt to the lowest priority */ 66 | NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; 67 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; 68 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; 69 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 70 | NVIC_Init(&NVIC_InitStructure); 71 | } 72 | 73 | void init_rs232(void) 74 | { 75 | USART_InitTypeDef USART_InitStructure; 76 | GPIO_InitTypeDef GPIO_InitStructure; 77 | 78 | /* Enable peripheral clocks. */ 79 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE); 80 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); 81 | 82 | /* Configure USART2 Rx pin as floating input. */ 83 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; 84 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 85 | GPIO_Init(GPIOA, &GPIO_InitStructure); 86 | 87 | /* Configure USART2 Tx as alternate function push-pull. */ 88 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; 89 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 90 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 91 | GPIO_Init(GPIOA, &GPIO_InitStructure); 92 | 93 | /* Configure the USART2 */ 94 | USART_InitStructure.USART_BaudRate = 9600; 95 | USART_InitStructure.USART_WordLength = USART_WordLength_8b; 96 | USART_InitStructure.USART_StopBits = USART_StopBits_1; 97 | USART_InitStructure.USART_Parity = USART_Parity_No; 98 | USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; 99 | USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; 100 | USART_Init(USART2, &USART_InitStructure); 101 | USART_Cmd(USART2, ENABLE); 102 | } 103 | 104 | void enable_rs232_interrupts(void) 105 | { 106 | NVIC_InitTypeDef NVIC_InitStructure; 107 | 108 | /* Enable transmit and receive interrupts for the USART2. */ 109 | USART_ITConfig(USART2, USART_IT_TXE, DISABLE); 110 | USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); 111 | 112 | /* Enable the USART2 IRQ in the NVIC module (so that the USART2 interrupt 113 | * handler is enabled). */ 114 | NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn; 115 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; 116 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 117 | NVIC_Init(&NVIC_InitStructure); 118 | } 119 | 120 | void enable_rs232(void) 121 | { 122 | /* Enable the RS232 port. */ 123 | USART_Cmd(USART2, ENABLE); 124 | } 125 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/GCC/PPC405_Xilinx/FPU_Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | /* When switching out a task, if the task tag contains a buffer address then 68 | save the flop context into the buffer. */ 69 | #define traceTASK_SWITCHED_OUT() \ 70 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 71 | { \ 72 | extern void vPortSaveFPURegisters( void * ); \ 73 | vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 74 | } 75 | 76 | /* When switching in a task, if the task tag contains a buffer address then 77 | load the flop context from the buffer. */ 78 | #define traceTASK_SWITCHED_IN() \ 79 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 80 | { \ 81 | extern void vPortRestoreFPURegisters( void * ); \ 82 | vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 83 | } 84 | 85 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/GCC/PPC440_Xilinx/FPU_Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | /* When switching out a task, if the task tag contains a buffer address then 68 | save the flop context into the buffer. */ 69 | #define traceTASK_SWITCHED_OUT() \ 70 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 71 | { \ 72 | extern void vPortSaveFPURegisters( void * ); \ 73 | vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 74 | } 75 | 76 | /* When switching in a task, if the task tag contains a buffer address then 77 | load the flop context from the buffer. */ 78 | #define traceTASK_SWITCHED_IN() \ 79 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 80 | { \ 81 | extern void vPortRestoreFPURegisters( void * ); \ 82 | vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 83 | } 84 | 85 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/WizC/PIC18/addFreeRTOS.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | /* 68 | Changes from V3.0.0 69 | 70 | Changes from V3.0.1 71 | 72 | Changes from V4.0.1 73 | Uselib pragma added for Croutine.c 74 | */ 75 | 76 | /* 77 | * The installation script will automatically prepend this file to the default FreeRTOS.h. 78 | */ 79 | 80 | #ifndef WIZC_FREERTOS_H 81 | #define WIZC_FREERTOS_H 82 | 83 | #pragma noheap 84 | #pragma wizcpp expandnl on 85 | #pragma wizcpp searchpath "$__PATHNAME__/libFreeRTOS/Include/" 86 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Croutine.c" 87 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Tasks.c" 88 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Queue.c" 89 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/List.c" 90 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Port.c" 91 | 92 | #endif /* WIZC_FREERTOS_H */ 93 | -------------------------------------------------------------------------------- /freertos/libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_pwr.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_PWR_H 25 | #define __STM32F10x_PWR_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup PWR 39 | * @{ 40 | */ 41 | 42 | /** @defgroup PWR_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup PWR_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup PVD_detection_level 55 | * @{ 56 | */ 57 | 58 | #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000) 59 | #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020) 60 | #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040) 61 | #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060) 62 | #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080) 63 | #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0) 64 | #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0) 65 | #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0) 66 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \ 67 | ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \ 68 | ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \ 69 | ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9)) 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup Regulator_state_is_STOP_mode 75 | * @{ 76 | */ 77 | 78 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 79 | #define PWR_Regulator_LowPower ((uint32_t)0x00000001) 80 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 81 | ((REGULATOR) == PWR_Regulator_LowPower)) 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup STOP_mode_entry 87 | * @{ 88 | */ 89 | 90 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 91 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 92 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** @defgroup PWR_Flag 99 | * @{ 100 | */ 101 | 102 | #define PWR_FLAG_WU ((uint32_t)0x00000001) 103 | #define PWR_FLAG_SB ((uint32_t)0x00000002) 104 | #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 105 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 106 | ((FLAG) == PWR_FLAG_PVDO)) 107 | 108 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** @defgroup PWR_Exported_Macros 118 | * @{ 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** @defgroup PWR_Exported_Functions 126 | * @{ 127 | */ 128 | 129 | void PWR_DeInit(void); 130 | void PWR_BackupAccessCmd(FunctionalState NewState); 131 | void PWR_PVDCmd(FunctionalState NewState); 132 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 133 | void PWR_WakeUpPinCmd(FunctionalState NewState); 134 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 135 | void PWR_EnterSTANDBYMode(void); 136 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 137 | void PWR_ClearFlag(uint32_t PWR_FLAG); 138 | 139 | #ifdef __cplusplus 140 | } 141 | #endif 142 | 143 | #endif /* __STM32F10x_PWR_H */ 144 | /** 145 | * @} 146 | */ 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 157 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/MSP430X/data_model.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | #ifndef DATA_MODEL_H 68 | #define DATA_MODEL_H 69 | 70 | #ifdef __DATA_MODEL_SMALL__ 71 | #define pushm_x pushm.w 72 | #define popm_x popm.w 73 | #define push_x push.w 74 | #define pop_x pop.w 75 | #define mov_x mov.w 76 | #define cmp_x cmp.w 77 | #endif 78 | 79 | #ifdef __DATA_MODEL_MEDIUM__ 80 | #define pushm_x pushm.a 81 | #define popm_x popm.a 82 | #define push_x pushx.a 83 | #define pop_x popx.a 84 | #define mov_x mov.w 85 | #define cmp_x cmp.w 86 | #endif 87 | 88 | #ifdef __DATA_MODEL_LARGE__ 89 | #define pushm_x pushm.a 90 | #define popm_x popm.a 91 | #define push_x pushx.a 92 | #define pop_x popx.a 93 | #define mov_x movx.a 94 | #define cmp_x cmpx.a 95 | #endif 96 | 97 | #ifndef pushm_x 98 | #error The assembler options must define one of the following symbols: __DATA_MODEL_SMALL__, __DATA_MODEL_MEDIUM__, or __DATA_MODEL_LARGE__ 99 | #endif 100 | 101 | #endif /* DATA_MODEL_H */ 102 | 103 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/STR71x/portasm.s79: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | RSEG ICODE:CODE 54 | CODE32 55 | 56 | EXTERN vPortPreemptiveTick 57 | EXTERN vTaskSwitchContext 58 | 59 | PUBLIC vPortYieldProcessor 60 | PUBLIC vPortStartFirstTask 61 | PUBLIC vPortPreemptiveTickISR 62 | 63 | #include "ISR_Support.h" 64 | 65 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 66 | ; Starting the first task is just a matter of restoring the context that 67 | ; was created by pxPortInitialiseStack(). 68 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 69 | vPortStartFirstTask: 70 | portRESTORE_CONTEXT 71 | 72 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 73 | ; Manual context switch function. This is the SWI hander. 74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 75 | vPortYieldProcessor: 76 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 77 | ; as if the context was saved during and IRQ 78 | ; handler. 79 | 80 | portSAVE_CONTEXT ; Save the context of the current task... 81 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 82 | mov lr, pc 83 | BX R0 84 | portRESTORE_CONTEXT ; Restore the context of the selected task. 85 | 86 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 87 | ; Preemptive context switch function. This will only ever get used if 88 | ; portUSE_PREEMPTION is set to 1 in portmacro.h. 89 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 90 | vPortPreemptiveTickISR: 91 | portSAVE_CONTEXT ; Save the context of the current task. 92 | 93 | LDR R0, =vPortPreemptiveTick ; Increment the tick count - this may wake a task. 94 | MOV lr, pc 95 | BX R0 96 | 97 | portRESTORE_CONTEXT ; Restore the context of the selected task. 98 | 99 | 100 | END 101 | 102 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/RL78/portasm.s87: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | 54 | #include "ISR_Support.h" 55 | 56 | 57 | #if __CORE__ != __RL78_1__ 58 | #error "This file is only for RL78 Devices" 59 | #endif 60 | 61 | #define CS 0xFFFFC 62 | #define ES 0xFFFFD 63 | 64 | PUBLIC vPortYield 65 | PUBLIC vPortStartFirstTask 66 | PUBLIC vPortTickISR 67 | 68 | EXTERN vTaskSwitchContext 69 | EXTERN vTaskIncrementTick 70 | 71 | ; FreeRTOS yield handler. This is installed as the BRK software interrupt 72 | ; handler. 73 | RSEG CODE:CODE 74 | vPortYield: 75 | portSAVE_CONTEXT ; Save the context of the current task. 76 | call vTaskSwitchContext ; Call the scheduler to select the next task. 77 | portRESTORE_CONTEXT ; Restore the context of the next task to run. 78 | retb 79 | 80 | 81 | ; Starts the scheduler by restoring the context of the task that will execute 82 | ; first. 83 | RSEG CODE:CODE 84 | vPortStartFirstTask: 85 | portRESTORE_CONTEXT ; Restore the context of whichever task the ... 86 | reti ; An interrupt stack frame is used so the task 87 | ; is started using a RETI instruction. 88 | 89 | ; FreeRTOS tick handler. This is installed as the interval timer interrupt 90 | ; handler. 91 | RSEG CODE:CODE 92 | vPortTickISR: 93 | 94 | portSAVE_CONTEXT ; Save the context of the current task. 95 | call vTaskIncrementTick ; Call the timer tick function. 96 | #if configUSE_PREEMPTION == 1 97 | call vTaskSwitchContext ; Call the scheduler to select the next task. 98 | #endif 99 | portRESTORE_CONTEXT ; Restore the context of the next task to run. 100 | reti 101 | 102 | 103 | ; Install the interrupt handlers 104 | 105 | COMMON INTVEC:CODE:ROOT(1) 106 | ORG 56 107 | DW vPortTickISR 108 | 109 | COMMON INTVEC:CODE:ROOT(1) 110 | ORG 126 111 | DW vPortYield 112 | 113 | 114 | END -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/RVDS/ARM7_LPC21xx/portmacro.inc: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | 54 | IMPORT ulCriticalNesting ; 55 | IMPORT pxCurrentTCB ; 56 | 57 | 58 | MACRO 59 | portRESTORE_CONTEXT 60 | 61 | 62 | LDR R0, =pxCurrentTCB ; Set the LR to the task stack. The location was... 63 | LDR R0, [R0] ; ... stored in pxCurrentTCB 64 | LDR LR, [R0] 65 | 66 | LDR R0, =ulCriticalNesting ; The critical nesting depth is the first item on... 67 | LDMFD LR!, {R1} ; ...the stack. Load it into the ulCriticalNesting var. 68 | STR R1, [R0] ; 69 | 70 | LDMFD LR!, {R0} ; Get the SPSR from the stack. 71 | MSR SPSR_cxsf, R0 ; 72 | 73 | LDMFD LR, {R0-R14}^ ; Restore all system mode registers for the task. 74 | NOP ; 75 | 76 | LDR LR, [LR, #+60] ; Restore the return address 77 | 78 | ; And return - correcting the offset in the LR to obtain ... 79 | SUBS PC, LR, #4 ; ...the correct address. 80 | 81 | MEND 82 | 83 | ; /**********************************************************************/ 84 | 85 | MACRO 86 | portSAVE_CONTEXT 87 | 88 | 89 | STMDB SP!, {R0} ; Store R0 first as we need to use it. 90 | 91 | STMDB SP,{SP}^ ; Set R0 to point to the task stack pointer. 92 | NOP ; 93 | SUB SP, SP, #4 ; 94 | LDMIA SP!,{R0} ; 95 | 96 | STMDB R0!, {LR} ; Push the return address onto the stack. 97 | MOV LR, R0 ; Now we have saved LR we can use it instead of R0. 98 | LDMIA SP!, {R0} ; Pop R0 so we can save it onto the system mode stack. 99 | 100 | STMDB LR,{R0-LR}^ ; Push all the system mode registers onto the task stack. 101 | NOP ; 102 | SUB LR, LR, #60 ; 103 | 104 | MRS R0, SPSR ; Push the SPSR onto the task stack. 105 | STMDB LR!, {R0} ; 106 | 107 | LDR R0, =ulCriticalNesting ; 108 | LDR R0, [R0] ; 109 | STMDB LR!, {R0} ; 110 | 111 | LDR R0, =pxCurrentTCB ; Store the new top of stack for the task. 112 | LDR R1, [R0] ; 113 | STR LR, [R1] ; 114 | 115 | MEND 116 | 117 | END 118 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/LPC2000/portasm.s79: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | RSEG ICODE:CODE 54 | CODE32 55 | 56 | EXTERN vTaskSwitchContext 57 | EXTERN vTaskIncrementTick 58 | EXTERN vPortPreemptiveTick 59 | 60 | PUBLIC vPortPreemptiveTickEntry 61 | PUBLIC vPortYieldProcessor 62 | PUBLIC vPortStartFirstTask 63 | 64 | #include "FreeRTOSConfig.h" 65 | #include "ISR_Support.h" 66 | 67 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 68 | ; Starting the first task is just a matter of restoring the context that 69 | ; was created by pxPortInitialiseStack(). 70 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 71 | vPortStartFirstTask: 72 | portRESTORE_CONTEXT 73 | 74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 75 | ; Manual context switch function. This is the SWI hander. 76 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 77 | vPortYieldProcessor: 78 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 79 | ; as if the context was saved during and IRQ 80 | ; handler. 81 | 82 | portSAVE_CONTEXT ; Save the context of the current task... 83 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 84 | mov lr, pc 85 | BX R0 86 | portRESTORE_CONTEXT ; Restore the context of the selected task. 87 | 88 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 89 | ; Preemptive context switch function. This will only ever get installed if 90 | ; portUSE_PREEMPTION is set to 1 in portmacro.h. 91 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 92 | vPortPreemptiveTickEntry: 93 | #if configUSE_PREEMPTION == 1 94 | portSAVE_CONTEXT ; Save the context of the current task... 95 | LDR R0, =vPortPreemptiveTick; before selecting the next task to execute. 96 | mov lr, pc 97 | BX R0 98 | portRESTORE_CONTEXT ; Restore the context of the selected task. 99 | #endif 100 | 101 | END 102 | 103 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/STR71x/ISR_Support.h: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | EXTERN pxCurrentTCB 54 | EXTERN ulCriticalNesting 55 | 56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 57 | ; Context save and restore macro definitions 58 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 59 | 60 | portSAVE_CONTEXT MACRO 61 | 62 | ; Push R0 as we are going to use the register. 63 | STMDB SP!, {R0} 64 | 65 | ; Set R0 to point to the task stack pointer. 66 | STMDB SP, {SP}^ 67 | NOP 68 | SUB SP, SP, #4 69 | LDMIA SP!, {R0} 70 | 71 | ; Push the return address onto the stack. 72 | STMDB R0!, {LR} 73 | 74 | ; Now we have saved LR we can use it instead of R0. 75 | MOV LR, R0 76 | 77 | ; Pop R0 so we can save it onto the system mode stack. 78 | LDMIA SP!, {R0} 79 | 80 | ; Push all the system mode registers onto the task stack. 81 | STMDB LR, {R0-LR}^ 82 | NOP 83 | SUB LR, LR, #60 84 | 85 | ; Push the SPSR onto the task stack. 86 | MRS R0, SPSR 87 | STMDB LR!, {R0} 88 | 89 | LDR R0, =ulCriticalNesting 90 | LDR R0, [R0] 91 | STMDB LR!, {R0} 92 | 93 | ; Store the new top of stack for the task. 94 | LDR R1, =pxCurrentTCB 95 | LDR R0, [R1] 96 | STR LR, [R0] 97 | 98 | ENDM 99 | 100 | 101 | portRESTORE_CONTEXT MACRO 102 | 103 | ; Set the LR to the task stack. 104 | LDR R1, =pxCurrentTCB 105 | LDR R0, [R1] 106 | LDR LR, [R0] 107 | 108 | ; The critical nesting depth is the first item on the stack. 109 | ; Load it into the ulCriticalNesting variable. 110 | LDR R0, =ulCriticalNesting 111 | LDMFD LR!, {R1} 112 | STR R1, [R0] 113 | 114 | ; Get the SPSR from the stack. 115 | LDMFD LR!, {R0} 116 | MSR SPSR_cxsf, R0 117 | 118 | ; Restore all system mode registers for the task. 119 | LDMFD LR, {R0-R14}^ 120 | NOP 121 | 122 | ; Restore the return address. 123 | LDR LR, [LR, #+60] 124 | 125 | ; And return - correcting the offset in the LR to obtain the 126 | ; correct address. 127 | SUBS PC, LR, #4 128 | 129 | ENDM 130 | 131 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/LPC2000/ISR_Support.h: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | EXTERN pxCurrentTCB 54 | EXTERN ulCriticalNesting 55 | 56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 57 | ; Context save and restore macro definitions 58 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 59 | 60 | portSAVE_CONTEXT MACRO 61 | 62 | ; Push R0 as we are going to use the register. 63 | STMDB SP!, {R0} 64 | 65 | ; Set R0 to point to the task stack pointer. 66 | STMDB SP, {SP}^ 67 | NOP 68 | SUB SP, SP, #4 69 | LDMIA SP!, {R0} 70 | 71 | ; Push the return address onto the stack. 72 | STMDB R0!, {LR} 73 | 74 | ; Now we have saved LR we can use it instead of R0. 75 | MOV LR, R0 76 | 77 | ; Pop R0 so we can save it onto the system mode stack. 78 | LDMIA SP!, {R0} 79 | 80 | ; Push all the system mode registers onto the task stack. 81 | STMDB LR, {R0-LR}^ 82 | NOP 83 | SUB LR, LR, #60 84 | 85 | ; Push the SPSR onto the task stack. 86 | MRS R0, SPSR 87 | STMDB LR!, {R0} 88 | 89 | LDR R0, =ulCriticalNesting 90 | LDR R0, [R0] 91 | STMDB LR!, {R0} 92 | 93 | ; Store the new top of stack for the task. 94 | LDR R1, =pxCurrentTCB 95 | LDR R0, [R1] 96 | STR LR, [R0] 97 | 98 | ENDM 99 | 100 | 101 | portRESTORE_CONTEXT MACRO 102 | 103 | ; Set the LR to the task stack. 104 | LDR R1, =pxCurrentTCB 105 | LDR R0, [R1] 106 | LDR LR, [R0] 107 | 108 | ; The critical nesting depth is the first item on the stack. 109 | ; Load it into the ulCriticalNesting variable. 110 | LDR R0, =ulCriticalNesting 111 | LDMFD LR!, {R1} 112 | STR R1, [R0] 113 | 114 | ; Get the SPSR from the stack. 115 | LDMFD LR!, {R0} 116 | MSR SPSR_cxsf, R0 117 | 118 | ; Restore all system mode registers for the task. 119 | LDMFD LR, {R0-R14}^ 120 | NOP 121 | 122 | ; Restore the return address. 123 | LDR LR, [LR, #+60] 124 | 125 | ; And return - correcting the offset in the LR to obtain the 126 | ; correct address. 127 | SUBS PC, LR, #4 128 | 129 | ENDM 130 | 131 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM7S64/ISR_Support.h: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | EXTERN pxCurrentTCB 54 | EXTERN ulCriticalNesting 55 | 56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 57 | ; Context save and restore macro definitions 58 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 59 | 60 | portSAVE_CONTEXT MACRO 61 | 62 | ; Push R0 as we are going to use the register. 63 | STMDB SP!, {R0} 64 | 65 | ; Set R0 to point to the task stack pointer. 66 | STMDB SP, {SP}^ 67 | NOP 68 | SUB SP, SP, #4 69 | LDMIA SP!, {R0} 70 | 71 | ; Push the return address onto the stack. 72 | STMDB R0!, {LR} 73 | 74 | ; Now we have saved LR we can use it instead of R0. 75 | MOV LR, R0 76 | 77 | ; Pop R0 so we can save it onto the system mode stack. 78 | LDMIA SP!, {R0} 79 | 80 | ; Push all the system mode registers onto the task stack. 81 | STMDB LR, {R0-LR}^ 82 | NOP 83 | SUB LR, LR, #60 84 | 85 | ; Push the SPSR onto the task stack. 86 | MRS R0, SPSR 87 | STMDB LR!, {R0} 88 | 89 | LDR R0, =ulCriticalNesting 90 | LDR R0, [R0] 91 | STMDB LR!, {R0} 92 | 93 | ; Store the new top of stack for the task. 94 | LDR R1, =pxCurrentTCB 95 | LDR R0, [R1] 96 | STR LR, [R0] 97 | 98 | ENDM 99 | 100 | 101 | portRESTORE_CONTEXT MACRO 102 | 103 | ; Set the LR to the task stack. 104 | LDR R1, =pxCurrentTCB 105 | LDR R0, [R1] 106 | LDR LR, [R0] 107 | 108 | ; The critical nesting depth is the first item on the stack. 109 | ; Load it into the ulCriticalNesting variable. 110 | LDR R0, =ulCriticalNesting 111 | LDMFD LR!, {R1} 112 | STR R1, [R0] 113 | 114 | ; Get the SPSR from the stack. 115 | LDMFD LR!, {R0} 116 | MSR SPSR_cxsf, R0 117 | 118 | ; Restore all system mode registers for the task. 119 | LDMFD LR, {R0-R14}^ 120 | NOP 121 | 122 | ; Restore the return address. 123 | LDR LR, [LR, #+60] 124 | 125 | ; And return - correcting the offset in the LR to obtain the 126 | ; correct address. 127 | SUBS PC, LR, #4 128 | 129 | ENDM 130 | 131 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/STR75x/ISR_Support.h: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | 54 | EXTERN pxCurrentTCB 55 | EXTERN ulCriticalNesting 56 | 57 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 58 | ; Context save and restore macro definitions 59 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 60 | 61 | portSAVE_CONTEXT MACRO 62 | 63 | ; Push R0 as we are going to use the register. 64 | STMDB SP!, {R0} 65 | 66 | ; Set R0 to point to the task stack pointer. 67 | STMDB SP, {SP}^ 68 | NOP 69 | SUB SP, SP, #4 70 | LDMIA SP!, {R0} 71 | 72 | ; Push the return address onto the stack. 73 | STMDB R0!, {LR} 74 | 75 | ; Now we have saved LR we can use it instead of R0. 76 | MOV LR, R0 77 | 78 | ; Pop R0 so we can save it onto the system mode stack. 79 | LDMIA SP!, {R0} 80 | 81 | ; Push all the system mode registers onto the task stack. 82 | STMDB LR, {R0-LR}^ 83 | NOP 84 | SUB LR, LR, #60 85 | 86 | ; Push the SPSR onto the task stack. 87 | MRS R0, SPSR 88 | STMDB LR!, {R0} 89 | 90 | LDR R0, =ulCriticalNesting 91 | LDR R0, [R0] 92 | STMDB LR!, {R0} 93 | 94 | ; Store the new top of stack for the task. 95 | LDR R1, =pxCurrentTCB 96 | LDR R0, [R1] 97 | STR LR, [R0] 98 | 99 | ENDM 100 | 101 | 102 | portRESTORE_CONTEXT MACRO 103 | 104 | ; Set the LR to the task stack. 105 | LDR R1, =pxCurrentTCB 106 | LDR R0, [R1] 107 | LDR LR, [R0] 108 | 109 | ; The critical nesting depth is the first item on the stack. 110 | ; Load it into the ulCriticalNesting variable. 111 | LDR R0, =ulCriticalNesting 112 | LDMFD LR!, {R1} 113 | STR R1, [R0] 114 | 115 | ; Get the SPSR from the stack. 116 | LDMFD LR!, {R0} 117 | MSR SPSR_cxsf, R0 118 | 119 | ; Restore all system mode registers for the task. 120 | LDMFD LR, {R0-R14}^ 121 | NOP 122 | 123 | ; Restore the return address. 124 | LDR LR, [LR, #+60] 125 | 126 | ; And return - correcting the offset in the LR to obtain the 127 | ; correct address. 128 | SUBS PC, LR, #4 129 | 130 | ENDM 131 | 132 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/Rowley/MSP430F449/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | #ifndef PORT_ASM_H 68 | #define PORT_ASM_H 69 | 70 | portSAVE_CONTEXT macro 71 | /* Save the remaining registers. */ 72 | push r4 73 | push r5 74 | push r6 75 | push r7 76 | push r8 77 | push r9 78 | push r10 79 | push r11 80 | push r12 81 | push r13 82 | push r14 83 | push r15 84 | mov.w &_usCriticalNesting, r14 85 | push r14 86 | mov.w &_pxCurrentTCB, r12 87 | mov.w r1, @r12 88 | endm 89 | /*-----------------------------------------------------------*/ 90 | 91 | portRESTORE_CONTEXT macro 92 | mov.w &_pxCurrentTCB, r12 93 | mov.w @r12, r1 94 | pop r15 95 | mov.w r15, &_usCriticalNesting 96 | pop r15 97 | pop r14 98 | pop r13 99 | pop r12 100 | pop r11 101 | pop r10 102 | pop r9 103 | pop r8 104 | pop r7 105 | pop r6 106 | pop r5 107 | pop r4 108 | 109 | /* The last thing on the stack will be the status register. 110 | Ensure the power down bits are clear ready for the next 111 | time this power down register is popped from the stack. */ 112 | bic.w #0xf0,0(SP) 113 | 114 | reti 115 | endm 116 | /*-----------------------------------------------------------*/ 117 | 118 | #endif 119 | 120 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/STR91x/portasm.s79: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | RSEG ICODE:CODE 68 | CODE32 69 | 70 | EXTERN vTaskSwitchContext 71 | 72 | PUBLIC vPortYieldProcessor 73 | PUBLIC vPortStartFirstTask 74 | 75 | #include "ISR_Support.h" 76 | 77 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 78 | ; Starting the first task is just a matter of restoring the context that 79 | ; was created by pxPortInitialiseStack(). 80 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 81 | vPortStartFirstTask: 82 | portRESTORE_CONTEXT 83 | 84 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 85 | ; Manual context switch function. This is the SWI hander. 86 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 87 | vPortYieldProcessor: 88 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 89 | ; as if the context was saved during and IRQ 90 | ; handler. 91 | 92 | portSAVE_CONTEXT ; Save the context of the current task... 93 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 94 | MOV lr, pc 95 | BX R0 96 | portRESTORE_CONTEXT ; Restore the context of the selected task. 97 | 98 | END 99 | 100 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/MSP430/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | 4 | 5 | *************************************************************************** 6 | * * 7 | * FreeRTOS tutorial books are available in pdf and paperback. * 8 | * Complete, revised, and edited pdf reference manuals are also * 9 | * available. * 10 | * * 11 | * Purchasing FreeRTOS documentation will not only help you, by * 12 | * ensuring you get running as quickly as possible and with an * 13 | * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | * the FreeRTOS project to continue with its mission of providing * 15 | * professional grade, cross platform, de facto standard solutions * 16 | * for microcontrollers - completely free of charge! * 17 | * * 18 | * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | * * 20 | * Thank you for using FreeRTOS, and thank you for your support! * 21 | * * 22 | *************************************************************************** 23 | 24 | 25 | This file is part of the FreeRTOS distribution. 26 | 27 | FreeRTOS is free software; you can redistribute it and/or modify it under 28 | the terms of the GNU General Public License (version 2) as published by the 29 | Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | >>>NOTE<<< The modification to the GPL is included to allow you to 31 | distribute a combined work that includes FreeRTOS without being obliged to 32 | provide the source code for proprietary components outside of the FreeRTOS 33 | kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | more details. You should have received a copy of the GNU General Public 37 | License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | by writing to Richard Barry, contact details for whom are available on the 40 | FreeRTOS WEB site. 41 | 42 | 1 tab == 4 spaces! 43 | 44 | *************************************************************************** 45 | * * 46 | * Having a problem? Start by reading the FAQ "My application does * 47 | * not run, what could be wrong? * 48 | * * 49 | * http://www.FreeRTOS.org/FAQHelp.html * 50 | * * 51 | *************************************************************************** 52 | 53 | 54 | http://www.FreeRTOS.org - Documentation, training, latest information, 55 | license and contact details. 56 | 57 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 58 | including FreeRTOS+Trace - an indispensable productivity tool. 59 | 60 | Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell 61 | the code with commercial support, indemnification, and middleware, under 62 | the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also 63 | provide a safety engineered and independently SIL3 certified version under 64 | the SafeRTOS brand: http://www.SafeRTOS.com. 65 | */ 66 | 67 | #ifndef PORTASM_H 68 | #define PORTASM_H 69 | 70 | portSAVE_CONTEXT macro 71 | 72 | IMPORT pxCurrentTCB 73 | IMPORT usCriticalNesting 74 | 75 | /* Save the remaining registers. */ 76 | push r4 77 | push r5 78 | push r6 79 | push r7 80 | push r8 81 | push r9 82 | push r10 83 | push r11 84 | push r12 85 | push r13 86 | push r14 87 | push r15 88 | mov.w &usCriticalNesting, r14 89 | push r14 90 | mov.w &pxCurrentTCB, r12 91 | mov.w r1, 0(r12) 92 | endm 93 | /*-----------------------------------------------------------*/ 94 | 95 | portRESTORE_CONTEXT macro 96 | mov.w &pxCurrentTCB, r12 97 | mov.w @r12, r1 98 | pop r15 99 | mov.w r15, &usCriticalNesting 100 | pop r15 101 | pop r14 102 | pop r13 103 | pop r12 104 | pop r11 105 | pop r10 106 | pop r9 107 | pop r8 108 | pop r7 109 | pop r6 110 | pop r5 111 | pop r4 112 | 113 | /* The last thing on the stack will be the status register. 114 | Ensure the power down bits are clear ready for the next 115 | time this power down register is popped from the stack. */ 116 | bic.w #0xf0,0(SP) 117 | 118 | reti 119 | endm 120 | /*-----------------------------------------------------------*/ 121 | 122 | #endif 123 | 124 | -------------------------------------------------------------------------------- /freertos/libraries/FreeRTOS/portable/IAR/AtmelSAM7S64/portasm.s79: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. 3 | ; 4 | ; 5 | ; *************************************************************************** 6 | ; * * 7 | ; * FreeRTOS tutorial books are available in pdf and paperback. * 8 | ; * Complete, revised, and edited pdf reference manuals are also * 9 | ; * available. * 10 | ; * * 11 | ; * Purchasing FreeRTOS documentation will not only help you, by * 12 | ; * ensuring you get running as quickly as possible and with an * 13 | ; * in-depth knowledge of how to use FreeRTOS, it will also help * 14 | ; * the FreeRTOS project to continue with its mission of providing * 15 | ; * professional grade, cross platform, de facto standard solutions * 16 | ; * for microcontrollers - completely free of charge! * 17 | ; * * 18 | ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * 19 | ; * * 20 | ; * Thank you for using FreeRTOS, and thank you for your support! * 21 | ; * * 22 | ; *************************************************************************** 23 | ; 24 | ; 25 | ; This file is part of the FreeRTOS distribution. 26 | ; 27 | ; FreeRTOS is free software; you can redistribute it and/or modify it under 28 | ; the terms of the GNU General Public License (version 2) as published by the 29 | ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 30 | ; >>>NOTE<<< The modification to the GPL is included to allow you to 31 | ; distribute a combined work that includes FreeRTOS without being obliged to 32 | ; provide the source code for proprietary components outside of the FreeRTOS 33 | ; kernel. FreeRTOS is distributed in the hope that it will be useful, but 34 | ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 35 | ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 36 | ; more details. You should have received a copy of the GNU General Public 37 | ; License and the FreeRTOS license exception along with FreeRTOS; if not it 38 | ; can be viewed here: http://www.freertos.org/a00114.html and also obtained 39 | ; by writing to Richard Barry, contact details for whom are available on the 40 | ; FreeRTOS WEB site. 41 | ; 42 | ; 1 tab == 4 spaces! 43 | ; 44 | ; http://www.FreeRTOS.org - Documentation, latest information, license and 45 | ; contact details. 46 | ; 47 | ; http://www.SafeRTOS.com - A version that is certified for use in safety 48 | ; critical systems. 49 | ; 50 | ; http://www.OpenRTOS.com - Commercial support, development, porting, 51 | ; licensing and training services. 52 | ;*/ 53 | RSEG ICODE:CODE 54 | CODE32 55 | 56 | EXTERN vTaskSwitchContext 57 | EXTERN vTaskIncrementTick 58 | 59 | PUBLIC vPortYieldProcessor 60 | PUBLIC vPortPreemptiveTick 61 | PUBLIC vPortStartFirstTask 62 | 63 | #include "AT91SAM7S64_inc.h" 64 | #include "ISR_Support.h" 65 | 66 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 67 | ; Starting the first task is just a matter of restoring the context that 68 | ; was created by pxPortInitialiseStack(). 69 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 70 | vPortStartFirstTask: 71 | portRESTORE_CONTEXT 72 | 73 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 74 | ; Manual context switch function. This is the SWI hander. 75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 76 | vPortYieldProcessor: 77 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 78 | ; as if the context was saved during and IRQ 79 | ; handler. 80 | 81 | portSAVE_CONTEXT ; Save the context of the current task... 82 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 83 | mov lr, pc 84 | BX R0 85 | portRESTORE_CONTEXT ; Restore the context of the selected task. 86 | 87 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 88 | ; Preemptive context switch function. This will only ever get installed if 89 | ; portUSE_PREEMPTION is set to 1 in portmacro.h. 90 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 91 | vPortPreemptiveTick: 92 | portSAVE_CONTEXT ; Save the context of the current task. 93 | 94 | LDR R0, =vTaskIncrementTick ; Increment the tick count - this may wake a task. 95 | mov lr, pc 96 | BX R0 97 | LDR R0, =vTaskSwitchContext ; Select the next task to execute. 98 | mov lr, pc 99 | BX R0 100 | 101 | LDR R14, =AT91C_BASE_PITC ; Clear the PIT interrupt 102 | LDR R0, [R14, #PITC_PIVR ] 103 | 104 | LDR R14, =AT91C_BASE_AIC ; Mark the End of Interrupt on the AIC 105 | STR R14, [R14, #AIC_EOICR] 106 | 107 | portRESTORE_CONTEXT ; Restore the context of the selected task. 108 | 109 | 110 | END 111 | 112 | --------------------------------------------------------------------------------