diff --git a/platforms/msp-exp430f5438-cc2564b/Makefile b/platforms/msp-exp430f5438-cc2564b/Makefile index 2aa49729e..59dc0c35c 100644 --- a/platforms/msp-exp430f5438-cc2564b/Makefile +++ b/platforms/msp-exp430f5438-cc2564b/Makefile @@ -12,13 +12,25 @@ CC2564B = bluetooth_init_cc2564B_1.0_BT_Spec_4.1.o CC2567 = CC256x_BT_Service_Pack_2.8_ANT_1.16.o BTSTACK_ROOT = ../.. +VPATH += example +VPATH += firmware +VPATH += src VPATH += $(BTSTACK_ROOT)/ble VPATH += $(BTSTACK_ROOT)/chipset-cc256x VPATH += $(BTSTACK_ROOT)/example/embedded VPATH += $(BTSTACK_ROOT)/src CC = msp430-gcc -CFLAGS = -mmcu=msp430f5438a -Os -Wall -fno-toplevel-reorder -I. -I$(BTSTACK_ROOT)/include -I$(BTSTACK_ROOT)/src -I$(BTSTACK_ROOT)/ble -I$(BTSTACK_ROOT)/chipset-cc256x +CFLAGS = -mmcu=msp430f5438a -Os -Wall -fno-toplevel-reorder +CFLAGS += \ + -I. \ + -I src \ + -I firmware \ + -I$(BTSTACK_ROOT)/include \ + -I$(BTSTACK_ROOT)/src \ + -I$(BTSTACK_ROOT)/ble \ + -I$(BTSTACK_ROOT)/chipset-cc256x \ + LDFLAGS = -mmcu=msp430f5438a CORE = \ @@ -133,9 +145,5 @@ clean: rm -f $ *.o *.out *.hex profile.h spp_and_le_counter.h ../driver/*.o ../../src/*.o ../src/*.o ../firmware/*.o ${BTSTACK_ROOT}/chipset-cc256x/*.o ${BTSTACK_ROOT}/src/*.o size: all - msp430-size ../firmware/*.o - msp430-size ../src/*.o - msp430-size ${BTSTACK_ROOT}/chipset-cc256x/*.o - msp430-size ${BTSTACK_ROOT}/src/*.o msp430-size *.o msp430-size *.out diff --git a/platforms/msp-exp430f5438-cc2564b/ant-test.c b/platforms/msp-exp430f5438-cc2564b/example/ant-test.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/ant-test.c rename to platforms/msp-exp430f5438-cc2564b/example/ant-test.c diff --git a/platforms/msp-exp430f5438-cc2564b/ble_server.c b/platforms/msp-exp430f5438-cc2564b/example/ble_server.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/ble_server.c rename to platforms/msp-exp430f5438-cc2564b/example/ble_server.c diff --git a/platforms/msp-exp430f5438-cc2564b/hid_demo.c b/platforms/msp-exp430f5438-cc2564b/example/hid_demo.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hid_demo.c rename to platforms/msp-exp430f5438-cc2564b/example/hid_demo.c diff --git a/platforms/msp-exp430f5438-cc2564b/led_counter.c b/platforms/msp-exp430f5438-cc2564b/example/led_counter.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/led_counter.c rename to platforms/msp-exp430f5438-cc2564b/example/led_counter.c diff --git a/platforms/msp-exp430f5438-cc2564b/spp_accel.c b/platforms/msp-exp430f5438-cc2564b/example/spp_accel.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/spp_accel.c rename to platforms/msp-exp430f5438-cc2564b/example/spp_accel.c diff --git a/platforms/msp-exp430f5438-cc2564b/UserExperienceGraphics.h b/platforms/msp-exp430f5438-cc2564b/firmware/UserExperienceGraphics.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/UserExperienceGraphics.h rename to platforms/msp-exp430f5438-cc2564b/firmware/UserExperienceGraphics.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_adc.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_adc.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_adc.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_adc.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_adc.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_adc.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_adc.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_adc.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_board.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_board.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_board.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_board.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_board.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_board.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_board.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_board.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_compat.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_compat.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_compat.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_compat.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_compat.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_compat.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_compat.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_compat.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_lcd.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_lcd.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_lcd.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_lcd.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_lcd_fonts.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd_fonts.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_lcd_fonts.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd_fonts.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_lcd_fonts.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd_fonts.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_lcd_fonts.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_lcd_fonts.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_usb.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_usb.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_usb.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_usb.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_usb.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_usb.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_usb.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_usb.h diff --git a/platforms/msp-exp430f5438-cc2564b/hal_util.c b/platforms/msp-exp430f5438-cc2564b/firmware/hal_util.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_util.c rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_util.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_util.h b/platforms/msp-exp430f5438-cc2564b/firmware/hal_util.h similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_util.h rename to platforms/msp-exp430f5438-cc2564b/firmware/hal_util.h diff --git a/platforms/msp-exp430f5438-cc2564b/profile.gatt b/platforms/msp-exp430f5438-cc2564b/profile.gatt deleted file mode 100644 index 2c734d235..000000000 --- a/platforms/msp-exp430f5438-cc2564b/profile.gatt +++ /dev/null @@ -1,11 +0,0 @@ -PRIMARY_SERVICE, GAP_SERVICE -CHARACTERISTIC, GAP_DEVICE_NAME, READ, "BTstack" -CHARACTERISTIC, GAP_APPEARANCE, READ, 00 00 - -PRIMARY_SERVICE, GATT_SERVICE -CHARACTERISTIC, GATT_SERVICE_CHANGED, READ, - -PRIMARY_SERVICE, FFF0 -CHARACTERISTIC, FFF1, READ | WRITE | DYNAMIC, -CHARACTERISTIC, FFF2, READ | WRITE | DYNAMIC, -CHARACTERISTIC, 00001234-0000-1000-8000-00805F9B34FB, READ | WRITE | DYNAMIC, diff --git a/platforms/msp-exp430f5438-cc2564b/hal_cpu.c b/platforms/msp-exp430f5438-cc2564b/src/hal_cpu.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_cpu.c rename to platforms/msp-exp430f5438-cc2564b/src/hal_cpu.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_tick.c b/platforms/msp-exp430f5438-cc2564b/src/hal_tick.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_tick.c rename to platforms/msp-exp430f5438-cc2564b/src/hal_tick.c diff --git a/platforms/msp-exp430f5438-cc2564b/hal_uart_dma.c b/platforms/msp-exp430f5438-cc2564b/src/hal_uart_dma.c similarity index 100% rename from platforms/msp-exp430f5438-cc2564b/hal_uart_dma.c rename to platforms/msp-exp430f5438-cc2564b/src/hal_uart_dma.c diff --git a/platforms/msp-exp430f5438-cc2564b/src/main.c b/platforms/msp-exp430f5438-cc2564b/src/main.c new file mode 100644 index 000000000..12f44bc39 --- /dev/null +++ b/platforms/msp-exp430f5438-cc2564b/src/main.c @@ -0,0 +1,76 @@ +// ***************************************************************************** +// +// spp_counter demo - it provides an SPP and sends a counter every second +// +// it doesn't use the LCD to get down to a minimal memory footprint +// +// ***************************************************************************** + +#include +#include +#include +#include + +#include + +#include "bt_control_cc256x.h" +#include "hal_board.h" +#include "hal_compat.h" +#include "hal_usb.h" + +#include + +#include "hci.h" +#include "btstack_memory.h" +#include "remote_device_db.h" +#include "btstack-config.h" + +static void hw_setup(){ + // stop watchdog timer + WDTCTL = WDTPW + WDTHOLD; + + //Initialize clock and peripherals + halBoardInit(); + halBoardStartXT1(); + halBoardSetSystemClock(SYSCLK_16MHZ); + + // init debug UART + halUsbInit(); + + // init LEDs + LED_PORT_OUT |= LED_1 | LED_2; + LED_PORT_DIR |= LED_1 | LED_2; + + // ready - enable irq used in h4 task + __enable_interrupt(); +} + +static void btstack_setup(){ + /// GET STARTED with BTstack /// + btstack_memory_init(); + run_loop_init(RUN_LOOP_EMBEDDED); + + // init HCI + hci_transport_t * transport = hci_transport_h4_dma_instance(); + bt_control_t * control = bt_control_cc256x_instance(); + hci_uart_config_t * config = hci_uart_config_cc256x_instance(); + remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory; + hci_init(transport, config, control, remote_db); + + // use eHCILL + bt_control_cc256x_enable_ehcill(1); +} + +int btstack_main(int argc, const char * argv[]); + +// main +int main(void){ + + hw_setup(); + + btstack_setup(); + btstack_main(0, NULL); + // happy compiler! + return 0; +} +