Added simulat0r
This commit is contained in:
parent
3edfff8d59
commit
20d9fee431
|
@ -0,0 +1,27 @@
|
|||
all : tui gui
|
||||
|
||||
.PHONY : tui gui tui-core clean
|
||||
|
||||
tui-core :
|
||||
$(MAKE) -C firmware
|
||||
$(MAKE) -C simcore
|
||||
$(MAKE) -C tui
|
||||
|
||||
tui : tui-core
|
||||
$(MAKE) -C gui/build clean # workaround for buggy dependency of gui build on libapp
|
||||
|
||||
.IGNORE : tui
|
||||
|
||||
gui : tui gui/build/Makefile
|
||||
$(MAKE) -C gui/build VERBOSE=1
|
||||
|
||||
# bootstrap build directory
|
||||
gui/build/Makefile : tui-core
|
||||
install -d gui/build && cd gui/build && cmake ..
|
||||
|
||||
|
||||
clean:
|
||||
$(MAKE) -C firmware clean
|
||||
$(MAKE) -C tui clean
|
||||
$(MAKE) -C simcore clean
|
||||
$(MAKE) -C gui/build clean # workaround for buggy dependency of gui build on libapp
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
function verbmsg()
|
||||
{
|
||||
true
|
||||
# echo $1
|
||||
}
|
||||
|
||||
echo "Updating directories"
|
||||
for i in `find firmware/ -type d `
|
||||
do
|
||||
if test -d simulat0r/$i
|
||||
then verbmsg "OK Directory already exists: $i"
|
||||
else mkdir -v simulat0r/$i
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Updating bridge files"
|
||||
for i in `find firmware/ \! -path firmware/lcd/allfonts.h -type f -iname \*.[ch]`
|
||||
do
|
||||
if test -f simulat0r/$i;
|
||||
then
|
||||
verbmsg "OK File already exists: $i"
|
||||
else
|
||||
echo Writing bridge file simulat0r/$i
|
||||
(printf "/* AUTOGENERATED SOURCE FILE */\n"; echo \#include \"`dirname $i | sed "s#[^/]*#..#g" `/../$i\") >simulat0r/$i
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,108 @@
|
|||
VPATH =
|
||||
OBJS = main.o
|
||||
|
||||
##########################################################################
|
||||
# Project-specific files
|
||||
##########################################################################
|
||||
|
||||
VPATH +=
|
||||
OBJS +=
|
||||
OBJS += basic/basic.o basic/reinvoke_isp.o basic/delayms.o basic/voltage.o
|
||||
OBJS += basic/keyin.o basic/uuid.o
|
||||
LIBS += core/libcore.a lcd/liblcd.a applications/libapp.a filesystem/libfat.a usb/libusb.a
|
||||
|
||||
##########################################################################
|
||||
# GNU GCC compiler flags
|
||||
##########################################################################
|
||||
ROOT_PATH = .
|
||||
INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core
|
||||
|
||||
include $(ROOT_PATH)/Makefile.inc
|
||||
|
||||
LDFLAGS+= -Wl,--gc-sections
|
||||
VPATH += lpc1xxx
|
||||
OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o
|
||||
|
||||
##########################################################################
|
||||
# Startup files
|
||||
##########################################################################
|
||||
LDLIBS = -lm
|
||||
LDLIBS += -Lapplications -lapp
|
||||
LDLIBS += -Lfunk -lfunk
|
||||
LDLIBS += -Lusbcdc -lusbcdc
|
||||
LDLIBS += -Lfilesystem -lfat
|
||||
LDLIBS += -Lbasic -lbasic
|
||||
LDLIBS += -Llcd -llcd
|
||||
LDLIBS += -Lcore -lcore
|
||||
LDLIBS += -Lusb -lusb
|
||||
|
||||
|
||||
LD_PATH = lpc1xxx
|
||||
LD_SCRIPT = $(LD_PATH)/linkscript.ld
|
||||
LD_TEMP = $(LD_PATH)/memory.ld
|
||||
|
||||
### User targets:
|
||||
|
||||
all: $(OUTFILE).bin
|
||||
|
||||
protect: $(OUTFILE).bin
|
||||
$(LPCFIX) -p 2 $(OUTFILE).bin
|
||||
|
||||
loadables: $(OUTFILE).bin
|
||||
@cd loadable && $(MAKE)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
|
||||
@cd core && $(MAKE) clean
|
||||
# @cd ../tools/bootloader && $(MAKE) clean
|
||||
@cd lcd && $(MAKE) clean
|
||||
@cd applications && $(MAKE) clean
|
||||
@cd filesystem && $(MAKE) clean
|
||||
@cd usb && $(MAKE) clean
|
||||
@cd loadable && $(MAKE) clean
|
||||
|
||||
### Internal targets
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
core/libcore.a: core/projectconfig.h
|
||||
cd core && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
||||
|
||||
lcd/liblcd.a lcd/render.o lcd/display.o:
|
||||
cd lcd && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
||||
|
||||
applications/libapp.a:
|
||||
cd applications && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
||||
|
||||
filesystem/libfat.a:
|
||||
cd filesystem && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
||||
|
||||
usb/libusb.a:
|
||||
cd usb && $(MAKE) ROOT_PATH=../$(ROOT_PATH)
|
||||
|
||||
../tools/bootloader/lpcfix:
|
||||
# cd ../tools/bootloader && $(MAKE)
|
||||
|
||||
$(LD_TEMP):
|
||||
-@echo "MEMORY" > $(LD_TEMP)
|
||||
-@echo "{" >> $(LD_TEMP)
|
||||
-@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
|
||||
-@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)-$(RAMCODE)" >> $(LD_TEMP)
|
||||
-@echo "}" >> $(LD_TEMP)
|
||||
-@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
|
||||
|
||||
.IGNORE: $(OUTFILE).elf
|
||||
$(OUTFILE).elf: $(OBJS) $(SYS_OBJS) $(LIBS) $(LPCFIX) $(LD_TEMP)
|
||||
$(CC) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
|
||||
-@echo ""
|
||||
# $(SIZE) $(OUTFILE).elf
|
||||
# -@echo ""
|
||||
|
||||
%.bin: %.elf
|
||||
# $(OBJCOPY) $(OCFLAGS) -O binary $< $@
|
||||
-@echo ""
|
||||
# $(LPCFIX) -c $@
|
||||
|
||||
.PHONY: $(LD_TEMP) lcd/liblcd.a applications/libapp.a filesystem/libfat.a usb/libusb.a
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
##########################################################################
|
||||
# User configuration and firmware specific object files
|
||||
##########################################################################
|
||||
|
||||
# The target, flash and ram of the LPC1xxx microprocessor.
|
||||
# Use for the target the value: LPC11xx, LPC13xx or LPC17xx
|
||||
TARGET = LPC13xx
|
||||
FLASH = 32K
|
||||
SRAM = 8K
|
||||
RAMCODE=1K
|
||||
|
||||
# For USB HID support the LPC134x reserves 384 bytes from the sram,
|
||||
# if you don't want to use the USB features, just use 0 here.
|
||||
SRAM_USB = 384
|
||||
|
||||
##########################################################################
|
||||
# GNU GCC compiler prefix and location
|
||||
##########################################################################
|
||||
|
||||
#CROSS_COMPILE = arm-none-eabi-
|
||||
AS = $(CROSS_COMPILE)gcc
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
LD = $(CROSS_COMPILE)ld
|
||||
REALLD = $(CROSS_COMPILE)ld
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||
OUTFILE = firmware
|
||||
LPCFIX = /bin/echo
|
||||
|
||||
ifeq (LPC11xx,$(TARGET))
|
||||
CORTEX_TYPE=m0
|
||||
else
|
||||
CORTEX_TYPE=m3
|
||||
endif
|
||||
|
||||
#CPU_TYPE = cortex-$(CORTEX_TYPE)
|
||||
#CPU_TYPE=i686
|
||||
|
||||
##########################################################################
|
||||
# Compiler settings, parameters and flags
|
||||
##########################################################################
|
||||
|
||||
CFLAGS = -std=c99 -c -g -O0 $(INCLUDE_PATHS) -Wall -funsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -DRAMCODE=$(RAMCODE) -fno-builtin -DSIMULATOR -I$(ROOT_PATH)/../simcore -include libc-unc0llide.h
|
||||
#LDFLAGS = -nostartfiles
|
||||
|
|
@ -0,0 +1 @@
|
|||
include $(ROOT_PATH)/../../firmware/Makefile.util
|
|
@ -0,0 +1,66 @@
|
|||
##########################################################################
|
||||
# User configuration and firmware specific object files
|
||||
##########################################################################
|
||||
|
||||
OBJS = default.o
|
||||
OBJS += $(foreach mod,$(APP),$(mod).o)
|
||||
|
||||
SRCS = $(foreach mod,$(APP),$(mod).c)
|
||||
|
||||
ifndef APP
|
||||
ME_OBJ=$(USERNAME)
|
||||
|
||||
ifeq "$(ME_OBJ)" ""
|
||||
ME_OBJ=$(USER)
|
||||
endif
|
||||
|
||||
ifeq "$(ME_OBJ)" ""
|
||||
ME_OBJ=nouser
|
||||
endif
|
||||
|
||||
OBJS += $(ME_OBJ).o
|
||||
endif
|
||||
|
||||
WRAP=wrapper
|
||||
LIBNAME=app
|
||||
|
||||
##########################################################################
|
||||
# GNU GCC compiler flags
|
||||
##########################################################################
|
||||
ROOT_PATH?= ..
|
||||
INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I.
|
||||
|
||||
include $(ROOT_PATH)/Makefile.inc
|
||||
|
||||
WRAPOBJ=$(WRAP).o
|
||||
WRAPSRC=$(WRAP).c
|
||||
LIBFILE=lib$(LIBNAME).a
|
||||
|
||||
##########################################################################
|
||||
# Compiler settings, parameters and flags
|
||||
##########################################################################
|
||||
|
||||
all: $(LIBFILE)
|
||||
|
||||
$(LIBFILE): $(OBJS) $(WRAPOBJ)
|
||||
$(AR) rcs $@ $(OBJS) $(WRAPOBJ)
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(WRAPOBJ) $(WRAPSRC) $(LIBFILE) *.o
|
||||
|
||||
%.c:
|
||||
@echo
|
||||
@echo "You need to create $@ first"
|
||||
@echo "It should contain a single function void main_filename(void)"
|
||||
@echo
|
||||
@exit 1
|
||||
|
||||
$(WRAPSRC):
|
||||
./mkwrapper $(OBJS) > $@
|
||||
|
||||
.PHONY: $(LIBFILE) $(WRAPSRC) $(SRCS)
|
||||
|
||||
.SUFFIXES:
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/adc.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/bsx.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/cdc.c"
|
|
@ -0,0 +1,12 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#define main_default _hideaway_main_default
|
||||
#define lcdInitConfig _hide_lcdInitConfig
|
||||
#include "../../../firmware/applications/default.c"
|
||||
#undef lcdInitConfig
|
||||
#undef main_default
|
||||
|
||||
int lcdInitConfig() {
|
||||
}
|
||||
|
||||
void main_default() {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/ecc.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/exe.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/executor.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/font.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/fs.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/funk.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/iggy.c"
|
|
@ -0,0 +1 @@
|
|||
#include "../../../firmware/applications/life.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/lilafisch.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/mandelbrot.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/mandelbrot2.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/menutest.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/minimal.c"
|
|
@ -0,0 +1 @@
|
|||
#include "../../../firmware/applications/rect.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/remote.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/s.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/schneider.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/scroll.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/sec.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/spaceinvaders.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/vcard.c"
|
|
@ -0,0 +1 @@
|
|||
#include "../../../firmware/applications/waldbrand.c"
|
|
@ -0,0 +1,2 @@
|
|||
void rbInit() {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/basic.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/byteorder.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/byteorder.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/crc.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/delayms.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/ecc.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/ecc.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/keyin.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/menu.c"
|
|
@ -0,0 +1,12 @@
|
|||
#include <core/gpio/gpio.h>
|
||||
|
||||
void ReinvokeISP(void) {
|
||||
}
|
||||
|
||||
void EnableWatchdog(uint32_t ms) {
|
||||
}
|
||||
|
||||
void ISPandReset(int delay){
|
||||
EnableWatchdog(1000*delay);
|
||||
ReinvokeISP();
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/uuid.c"
|
|
@ -0,0 +1,12 @@
|
|||
#include <sysinit.h>
|
||||
|
||||
#include "basic/basic.h"
|
||||
|
||||
uint32_t results=5000;
|
||||
|
||||
void VoltageCheck(void){
|
||||
};
|
||||
|
||||
uint32_t GetVoltage(void){
|
||||
return results;
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/xxtea.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/xxtea.h"
|
|
@ -0,0 +1,56 @@
|
|||
##########################################################################
|
||||
# User configuration and firmware specific object files
|
||||
##########################################################################
|
||||
|
||||
# The target, flash and ram of the LPC1xxx microprocessor.
|
||||
# Use for the target the value: LPC11xx, LPC13xx or LPC17xx
|
||||
TARGET = LPC13xx
|
||||
|
||||
OBJS = sysinit.o
|
||||
OBJS += adc/adc.o
|
||||
#OBJS += cmd/cmd.o
|
||||
OBJS += cpu/cpu.o
|
||||
OBJS += gpio/gpio.o
|
||||
OBJS += i2c/i2c.o
|
||||
OBJS += iap/iap.o
|
||||
OBJS += libc/ctype.o
|
||||
OBJS += libc/stdio.o
|
||||
OBJS += libc/string.o
|
||||
OBJS += pmu/pmu.o
|
||||
#OBJS += pwm/pwm.o
|
||||
OBJS += ssp/ssp.o
|
||||
OBJS += systick/systick.o
|
||||
OBJS += timer16/timer16.o
|
||||
OBJS += timer32/timer32.o
|
||||
#OBJS += uart/uart.o
|
||||
#OBJS += uart/uart_buf.o
|
||||
#OBJS += usbcdc/cdcuser.o
|
||||
#OBJS += usbcdc/cdc_buf.o
|
||||
#OBJS += usbcdc/usbcore.o
|
||||
#OBJS += usbcdc/usbdesc.o
|
||||
#OBJS += usbcdc/usbhw.o
|
||||
#OBJS += usbcdc/usbuser.o
|
||||
OBJS += wdt/wdt.o
|
||||
|
||||
##########################################################################
|
||||
# GNU GCC compiler flags
|
||||
##########################################################################
|
||||
ROOT_PATH?= ..
|
||||
INCLUDE_PATHS = -I$(ROOT_PATH) -I.
|
||||
|
||||
include $(ROOT_PATH)/Makefile.inc
|
||||
|
||||
##########################################################################
|
||||
# Compiler settings, parameters and flags
|
||||
##########################################################################
|
||||
|
||||
all: libcore.a
|
||||
|
||||
libcore.a: $(OBJS)
|
||||
$(AR) rcs libcore.a $(OBJS)
|
||||
|
||||
%.o : %.c projectconfig.h
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) libcore.a
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/adc/adc.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/adc/adc.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/cmd/cmd.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/cmd/cmd.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/cpu/cpu.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/cpu/cpu.h"
|
|
@ -0,0 +1,65 @@
|
|||
#include <core/gpio/gpio.h>
|
||||
#include "basic/basic.h"
|
||||
#include "../simcore/simulator.h"
|
||||
|
||||
static bool compair(uint32_t a1, uint32_t a2, uint32_t b1, uint32_t b2) {
|
||||
return a1==b1 && a2==b2;
|
||||
}
|
||||
|
||||
void gpioInit (void) {
|
||||
printf("void gpioInit (void)\n");
|
||||
}
|
||||
|
||||
void gpioSetDir (uint32_t portNum, uint32_t bitPos, gpioDirection_t dir) {
|
||||
printf("void gpioSetDir (portNum %d, bitPos %d, dir %x)\n",portNum,bitPos,dir);
|
||||
}
|
||||
|
||||
uint32_t gpioGetValue (uint32_t portNum, uint32_t bitPos) {
|
||||
if(compair(portNum, bitPos, RB_BTN3)) return simButtonPressed(BTN_UP);
|
||||
if(compair(portNum, bitPos, RB_BTN2)) return simButtonPressed(BTN_DOWN);
|
||||
if(compair(portNum, bitPos, RB_BTN4)) return simButtonPressed(BTN_ENTER);
|
||||
if(compair(portNum, bitPos, RB_BTN0)) return simButtonPressed(BTN_LEFT);
|
||||
if(compair(portNum, bitPos, RB_BTN1)) return simButtonPressed(BTN_RIGHT);
|
||||
|
||||
if(compair(portNum, bitPos, RB_LED0)) return simGetLED(0);
|
||||
if(compair(portNum, bitPos, RB_LED1)) return simGetLED(1);
|
||||
if(compair(portNum, bitPos, RB_LED2)) return simGetLED(2);
|
||||
if(compair(portNum, bitPos, RB_LED3)) return simGetLED(3);
|
||||
|
||||
fprintf(stderr,"Unimplemented gpioGetValue portNum %d %x bit %d\n",portNum, portNum, bitPos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gpioSetValue (uint32_t portNum, uint32_t bitPos, uint32_t bitVal) {
|
||||
if(compair(portNum, bitPos, RB_LED0)) return simSetLED(0,bitVal);
|
||||
if(compair(portNum, bitPos, RB_LED1)) return simSetLED(1,bitVal);
|
||||
if(compair(portNum, bitPos, RB_LED2)) return simSetLED(2,bitVal);
|
||||
if(compair(portNum, bitPos, RB_LED3)) return simSetLED(3,bitVal);
|
||||
|
||||
fprintf(stderr,"Unimplemented gpioSetValue portNum %d %x bit %d\n",portNum, portNum, bitPos);
|
||||
}
|
||||
|
||||
void gpioSetInterrupt (uint32_t portNum, uint32_t bitPos, gpioInterruptSense_t sense, gpioInterruptEdge_t edge, gpioInterruptEvent_t event) {
|
||||
printf("void gpioSetInterrupt (uint32_t portNum, uint32_t bitPos, gpioInterruptSense_t sense, gpioInterruptEdge_t edge, gpioInterruptEvent_t event)\n");
|
||||
}
|
||||
|
||||
void gpioIntEnable (uint32_t portNum, uint32_t bitPos) {
|
||||
printf("void gpioIntEnable (uint32_t portNum, uint32_t bitPos)\n");
|
||||
}
|
||||
|
||||
void gpioIntDisable (uint32_t portNum, uint32_t bitPos) {
|
||||
printf("void gpioIntDisable (uint32_t portNum, uint32_t bitPos)\n");
|
||||
}
|
||||
|
||||
uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos) {
|
||||
printf("uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos)\n");
|
||||
}
|
||||
|
||||
void gpioIntClear (uint32_t portNum, uint32_t bitPos) {
|
||||
printf("void gpioIntClear (uint32_t portNum, uint32_t bitPos)\n");
|
||||
}
|
||||
|
||||
void gpioSetPullup (volatile uint32_t *ioconRegister, gpioPullupMode_t mode) {
|
||||
printf("void gpioSetPullup (volatile uint32_t *ioconRegister, gpioPullupMode_t mode)\n");
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/gpio/gpio.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/i2c/i2c.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/i2c/i2c.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/iap/iap.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/iap/iap.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/libc/ctype.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/libc/stdio.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/libc/string.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/core/lpc134x.h"
|
|
@ -0,0 +1,2 @@
|
|||
#define volatile(x) volatile("nop")
|
||||
#include "../../../../firmware/core/pmu/pmu.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/pmu/pmu.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/core/projectconfig.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/pwm/pwm.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/pwm/pwm.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/core/rom_drivers.h"
|
|
@ -0,0 +1,23 @@
|
|||
#define sspInit _hideaway_sspInit
|
||||
#define sspSend _hideaway_sspSend
|
||||
#define sspReceive _hideaway_sspReceive
|
||||
#define sspSendReceive _hideaway_sspSendReceive
|
||||
|
||||
#include "../../../../firmware/core/ssp/ssp.c"
|
||||
|
||||
#undef sspInit
|
||||
#undef sspSend
|
||||
#undef sspReceive
|
||||
#undef sspSendReceive
|
||||
|
||||
void sspInit (uint8_t portNum, sspClockPolarity_t polarity, sspClockPhase_t phase) {
|
||||
}
|
||||
|
||||
void sspSend (uint8_t portNum, const uint8_t *buf, uint32_t length) {
|
||||
}
|
||||
|
||||
void sspReceive (uint8_t portNum, uint8_t *buf, uint32_t length) {
|
||||
}
|
||||
|
||||
void sspSendReceive(uint8_t portNum, uint8_t *buf, uint32_t length) {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/ssp/ssp.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/core/sysdefs.h"
|
|
@ -0,0 +1,83 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//#define handle_error(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
|
||||
#define handle_error(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
|
||||
|
||||
#include "core/lpc134x.h"
|
||||
|
||||
void testByte(void* addr) {
|
||||
fprintf(stderr,"Testing address %x : read ",addr);
|
||||
fprintf(stderr,"%x, write ",(int)(*((char*)addr)));
|
||||
++(*((char*)addr));
|
||||
fprintf(stderr,"%x",(int)(*((char*)addr)));
|
||||
--(*((char*)addr));
|
||||
fprintf(stderr," OK\n");
|
||||
}
|
||||
|
||||
void testMemoryHack(void* addr,long size) {
|
||||
fprintf(stderr,"Testing memory range %x - %x\n",addr,addr+size);
|
||||
for(void* p=addr; p<addr+size; p+=sysconf(_SC_PAGE_SIZE)) {
|
||||
testByte(p);
|
||||
}
|
||||
}
|
||||
|
||||
int setupMemoryHack(void* address, long size) {
|
||||
char *addr;
|
||||
int fd;
|
||||
struct stat sb;
|
||||
off_t offset, pa_offset;
|
||||
size_t length;
|
||||
ssize_t s;
|
||||
|
||||
FILE *tempfil=tmpfile();
|
||||
fd = fileno(tempfil);
|
||||
ftruncate(fd,size);
|
||||
if (fd == -1)
|
||||
handle_error("open");
|
||||
|
||||
if (fstat(fd, &sb) == -1) /* To obtain file size */
|
||||
handle_error("fstat");
|
||||
|
||||
offset = 0;
|
||||
pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);
|
||||
/* offset for mmap() must be page aligned */
|
||||
|
||||
if (offset >= sb.st_size) {
|
||||
fprintf(stderr, "offset is past end of file\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
length = size;
|
||||
|
||||
addr = mmap(address, length + offset - pa_offset, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE, fd, pa_offset);
|
||||
if (addr == MAP_FAILED)
|
||||
handle_error("mmap");
|
||||
if(addr!=address) {
|
||||
fprintf(stderr, "mmap: wanted %x, got %x: ",address,addr);
|
||||
handle_error("mmap address discrepancy");
|
||||
}
|
||||
// testMemoryHack(address,size);
|
||||
fprintf(stderr,"Range %x tested\n",addr);
|
||||
}
|
||||
|
||||
|
||||
void systemInit()
|
||||
{
|
||||
// setupMemoryHack((void*)0x40000000,0x1000000);
|
||||
// setupMemoryHack((void*)0x50000000,10*1024*1024);
|
||||
// setupMemoryHack((void*)0x10000000,10*1024*1024);
|
||||
// systick stuff unmappable setupMemoryHack((void*)0xe0000000,0x10000);
|
||||
|
||||
#if 0
|
||||
printf("Test %d\n",SSP_SSP0CR0);
|
||||
printf("Test2 %d\n",++SSP_SSP0CR0);
|
||||
printf("Test3 pre %x\n",&SYSTICK_STRELOAD);
|
||||
// printf("Test3 %d\n",++SYSTICK_STRELOAD);
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/core/sysinit.h"
|
|
@ -0,0 +1,231 @@
|
|||
#warning "cleanupthisfile"
|
||||
#if 0
|
||||
#include "../../firmware/core/systick/systick.c"
|
||||
#else
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file systick.c
|
||||
@author K. Townsend (microBuilder.eu)
|
||||
@date 22 March 2010
|
||||
@version 0.10
|
||||
|
||||
@section DESCRIPTION
|
||||
|
||||
Controls the 24-bit 'system tick' clock, which can be used as a
|
||||
generic timer or to control time sharing with an embedded real-time
|
||||
operating system (such as FreeRTOS).
|
||||
|
||||
@section Example
|
||||
|
||||
@code
|
||||
#include "core/cpu/cpu.h"
|
||||
#include "core/systick/systick.h"
|
||||
|
||||
void main (void)
|
||||
{
|
||||
cpuInit();
|
||||
|
||||
// Start systick timer with one tick every 10ms
|
||||
systickInit(10);
|
||||
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2010, microBuilder SARL
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#include "systick.h"
|
||||
|
||||
volatile uint32_t systickTicks = 0; // 1ms tick counter
|
||||
volatile uint32_t systickRollovers = 0;
|
||||
|
||||
void tick_wrapper(void);
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Systick interrupt handler
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void SysTick_Handler (void)
|
||||
{
|
||||
systickTicks++;
|
||||
|
||||
// Increment rollover counter
|
||||
if (systickTicks == 0xFFFFFFFF) systickRollovers++;
|
||||
|
||||
tick_wrapper();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Configures the systick timer
|
||||
|
||||
@param[in] ticks
|
||||
The number of clock cycles between each tick of the
|
||||
systick timer. for example, 'CFG_CPU_CCLK / 1000' =
|
||||
1 millisecond. This value must not exceed 0x00FFFFFF.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
static uint32_t systickConfig(uint32_t ticks)
|
||||
{
|
||||
fprintf(stderr,"systickConfig: unimplemented\n");
|
||||
return 0;
|
||||
|
||||
// Check if 'ticks' is greater than maximum value
|
||||
if (ticks > SYSTICK_STRELOAD_MASK)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
// Reset counter
|
||||
systickTicks = 0;
|
||||
|
||||
// Set reload register
|
||||
SYSTICK_STRELOAD = (ticks & SYSTICK_STRELOAD_MASK) - 1;
|
||||
|
||||
// Load the systick counter value
|
||||
SYSTICK_STCURR = 0;
|
||||
|
||||
// Enable systick IRQ and timer
|
||||
SYSTICK_STCTRL = SYSTICK_STCTRL_CLKSOURCE |
|
||||
SYSTICK_STCTRL_TICKINT |
|
||||
SYSTICK_STCTRL_ENABLE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Initialises the systick timer
|
||||
|
||||
@param[in] delayMs
|
||||
The number of milliseconds between each tick of the systick
|
||||
timer.
|
||||
|
||||
@note The shortest possible delay is 1 millisecond, which will
|
||||
allow fine grained delays, but will cause more load on the
|
||||
system than a 10mS delay. The resolution of the systick
|
||||
timer needs to be balanced with the amount of processing
|
||||
time you can spare. The delay should really only be set
|
||||
to 1 mS if you genuinely have a need for 1mS delays,
|
||||
otherwise a higher value like 5 or 10 mS is probably
|
||||
more appropriate.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void systickInit (uint32_t delayMs)
|
||||
{
|
||||
systickConfig ((CFG_CPU_CCLK / 1000) * delayMs);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Causes a blocking delay for 'delayTicks' ticks on the
|
||||
systick timer. For example: systickDelay(100) would cause
|
||||
a blocking delay for 100 ticks of the systick timer.
|
||||
|
||||
@param[in] delayTicks
|
||||
The number of systick ticks to cause a blocking delay for
|
||||
|
||||
@Note This function takes into account the fact that the tick
|
||||
counter may eventually roll over to 0 once it reaches
|
||||
0xFFFFFFFF.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void systickDelay (uint32_t delayTicks)
|
||||
{
|
||||
uint32_t curTicks;
|
||||
curTicks = systickTicks;
|
||||
|
||||
// Make sure delay is at least 1 tick in case of division, etc.
|
||||
if (delayTicks == 0) delayTicks = 1;
|
||||
|
||||
if (curTicks > 0xFFFFFFFF - delayTicks)
|
||||
{
|
||||
// Rollover will occur during delay
|
||||
while (systickTicks >= curTicks)
|
||||
{
|
||||
while (systickTicks < (delayTicks - (0xFFFFFFFF - curTicks)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((systickTicks - curTicks) < delayTicks);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Returns the current value of the systick timer counter.
|
||||
This value is incremented by one every time an interrupt
|
||||
fires for the systick timer.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint32_t systickGetTicks(void)
|
||||
{
|
||||
return systickTicks;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Returns the current value of the systick timer rollover
|
||||
counter. This value is incremented by one every time the
|
||||
tick counter rolls over from 0xFFFFFFFF to 0.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint32_t systickGetRollovers(void)
|
||||
{
|
||||
return systickRollovers;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Returns the approximate number of seconds that the
|
||||
systick timer has been running.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint32_t systickGetSecondsActive(void)
|
||||
{
|
||||
uint32_t currentTick = systickTicks;
|
||||
uint32_t rollovers = systickRollovers;
|
||||
uint32_t secsActive = currentTick / (1000 / CFG_SYSTICK_DELAY_IN_MS);
|
||||
secsActive += rollovers * (0xFFFFFFFF / (1000 / CFG_SYSTICK_DELAY_IN_MS));
|
||||
|
||||
return secsActive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/systick/systick.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/timer16/timer16.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/timer16/timer16.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/timer32/timer32.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/timer32/timer32.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/uart/uart.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/uart/uart.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/uart/uart_buf.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/cdc.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/cdc_buf.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/cdc_buf.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/cdcuser.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/cdcuser.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/config.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usb.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbcfg.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbcore.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbcore.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbdesc.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbdesc.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbhw.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbhw.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbreg.h"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/core/usbcdc/usbuser.c"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue