change building process yes, again

This commit is contained in:
hathach
2012-12-07 17:59:46 +07:00
parent cd74f4f0ed
commit 70e3a13951
12 changed files with 1180 additions and 102 deletions

View File

@@ -57,17 +57,22 @@
#include <stdint.h>
#define TICKS_PER_SECOND 1000
/// n-th Bit
#ifndef BIT
#define BIT(n) (1 << (n))
#endif
#define BOARD_NGX43XX 1
#define BOARD_LPCXPRESSOUXX 2
#define BOARD_LPCXPRESSO1347 2
#define BOARD_AT86RF2XX 3
#if BOARD == BOARD_NGX43XX
//#include "board_ngx4330.h"
#elif BOARD == BOARD_LPCXPRESSO13UXX
#elif BOARD == BOARD_LPCXPRESSO1347
#elif BOARD == BOARD_AT86RF2XX
#else
#error BOARD is not defined or supported yet

View File

@@ -1,5 +1,5 @@
/*
* board_at86rf2xx_11uxx.c
* board_at86rf2xx.c
*
* Created on: Dec 7, 2012
* Author: hathach
@@ -37,7 +37,7 @@
#include "board.h"
#if BOARD == BOARD_AT86RF2XX_11UXX
#if BOARD == BOARD_AT86RF2XX
#include "LPC11Uxx.h"
#include "gpio.h"

View File

@@ -37,9 +37,10 @@
#include "board.h"
#if BOARD == BOARD_LPCXPRESSO13UXX
#if BOARD == BOARD_LPCXPRESSO1347
#include "LPC13Uxx.h"
#include "gpio.h"
#define CFG_LED_PORT (0)
#define CFG_LED_PIN (7)
@@ -49,7 +50,7 @@
void board_init(void)
{
SystemInit();
systickInit(1);
SysTick_Config(SystemCoreClock / TICKS_PER_SECOND); // 1 msec tick timer
GPIOInit();
GPIOSetDir(CFG_LED_PORT, CFG_LED_PIN, 1);
LPC_GPIO->CLR[CFG_LED_PORT] = (1 << CFG_LED_PIN);
@@ -58,7 +59,7 @@ void board_init(void)
void board_leds(uint32_t mask, uint32_t state)
{
if (mask)
GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, state);
GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, mask & state);
}
#endif

View File

@@ -1,5 +1,3 @@
#ifdef __LPC11UXX__
//*****************************************************************************
// +--+
// | ++----+
@@ -47,8 +45,6 @@ extern "C" {
#define WEAK __attribute__ ((weak))
#define ALIAS(f) __attribute__ ((weak, alias (#f)))
#define __USE_CMSIS // Added by nxpUSBlib
// Code Red - if CMSIS is being used, then SystemInit() routine
// will be called by startup code rather than in application's main()
#if defined (__USE_CMSIS)
@@ -383,4 +379,3 @@ void IntDefaultHandler(void)
}
}
#endif /* __LPC11UXX__ */

View File

@@ -5,11 +5,11 @@ CFLAGS = $(MACROS_DEF) $(INC_PATH)
MACROS_DEF += -DBOARD=$(board) -DMCU=MCU_$(MCU)
#MCU currently supported
mcu_support = 13UXX
mcu_support = 13UXX 11UXX
################ Board and MCU determination ################
#all configuration build's name must be named after the macro BOARD_NAME defined in the tinyusb/demos/boards/board.h
buildname := $(shell echo $(notdir $(build_dir)) | tr a-z A-Z)
buildname = $(shell echo $(notdir $(build_dir)) | tr a-z A-Z)
board = $(buildname)
mcu = $(shell echo $(MCU) | tr A-Z a-z)
@@ -19,12 +19,14 @@ ifeq (,$(findstring BOARD_,$(board)))
$(error build's name must be name exactly the same as the macro BOARD_NAME defined in the tinyusb/demos/boards/board.h)
endif
MCU := LPC$(findstring $(mcu_support),$(board))
MCU := $(strip $(foreach supported_chip, $(mcu_support), $(findstring $(supported_chip),$(board))))
ifeq (,$(MCU))
$(error build name must contain one of supported mcu: $(mcu_support))
endif
MCU := LPC$(MCU)
$(warning MCU $(MCU) $(mcu))
################ Build Manipulate ################
@@ -36,20 +38,19 @@ toolchain = xpresso
OBJS := $(filter-out ./bsp/$(mcu)/startup%,$(OBJS)) $(filter ./bsp/$(mcu)/startup_$(toolchain)%,$(OBJS))
#CMSIS include path & lib path
cmsis_proj = CMSISv2p10_$(shell echo $(MCU) | tr X x)
cmsis_proj = $(shell cd $(workspace_dir); ls | grep -i "CMSIS.*$(MCU)")
rel_include += $(cmsis_proj)/inc
rel_include += demos/bsp/boards
rel_include += demos/bsp/$(mcu)/inc
INC_PATH = $(addprefix -I"$(workspace_dir)/, $(addsuffix ",$(rel_include)))
LIBS += -l$(cmsis_proj) -L"$(workspace_dir)/$(cmsis_proj)/Debug"
#$(warning $(OBJS))
#$(error $(OBJS))
#generate makefiles.def containing MCU define for tinyusb lib
$(shell echo CFLAGS = -DMCU=MCU_$(MCU) > $(workspace_dir)/tinyusb/makefile.defs)
#tinyusb_CFLAGS = -DMCU=MCU_$(MCU) -I\"$(workspace_dir)/$(cmsis_proj)/inc\"
#$(shell echo CFLAGS = $(tinyusb_CFLAGS) > $(workspace_dir)/tinyusb/makefile.defs)
#$(shell echo $$\(warning MCU = MCU_$(MCU)\) >> $(workspace_dir)/tinyusb/makefile.defs)

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@
<name>device_keyboard</name>
<comment></comment>
<projects>
<project>tinyusb</project>
</projects>
<buildSpec>
<buildCommand>
@@ -86,4 +87,15 @@
<location>C:/Users/hathach/Dropbox/tinyusb/tinyusb/demos/bsp</location>
</link>
</linkedResources>
<filteredResources>
<filter>
<id>1354876380300</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-startup_keil</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

View File

@@ -4,7 +4,7 @@
#include <cr_section_macros.h>
#include <NXP/crp.h>
#include "board.h"
#include "boards/board.h"
#include "tusb.h"
// Variable to store CRP value in. Will be placed automatically
@@ -12,22 +12,26 @@
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;
volatile uint32_t system_tick = 0;
void SysTick_Handler (void)
{
system_tick++;
}
int main(void)
{
uint32_t currentSecond, lastSecond;
currentSecond = lastSecond = 0;
uint32_t current_tick = system_tick;
board_init();
tusb_init();
while (1)
{
currentSecond = systickGetSecondsActive();
if (currentSecond != lastSecond)
if (current_tick + 1000 < system_tick)
{
/* Toggle LED once per second */
lastSecond = currentSecond;
board_leds(0x01, lastSecond%2);
current_tick += 1000;
board_leds(0x01, (current_tick/1000)%2); /* Toggle LED once per second */
#ifndef CFG_CLASS_CDC
if (usb_isConfigured())

View File

@@ -5,6 +5,6 @@ proj_path = $(build_dir)/..
#get workspace absolute path
workspace_dir = $(shell cd $(proj_path)/../../.. ; pwd)
#workspace_dir = $(proj_path)/../../../
$(warning workspace $(workspace_dir))
#$(warning workspace $(workspace_dir))
include $(workspace_dir)/demos/demos.mk
#include $(workspace_dir)/demos/demos.mk