diff --git a/common.cmake b/common.cmake index d6ce9bf0df1cd87465fa3998d31c6a6c9d01ba9b..e21a533958c33bd94b509d7e0715ae177c3b1480 100644 --- a/common.cmake +++ b/common.cmake @@ -10,7 +10,6 @@ enable_language(C) include_directories($ENV{MSP_GCC_ROOT}/include) # MSP430 headers add_compile_options( -std=c99 - -mcpu=msp430 -mmcu=msp430fr5994 -msmall -mhwmult=none @@ -19,12 +18,12 @@ add_compile_options( ) # Linker scripts -#set(CMAKE_EXE_LINKER_FLAGS -# "${CMAKE_EXE_LINKER_FLAGS} -T ${CMAKE_SOURCE_DIR}/../msp430fr5994.ld ") +set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -T $ENV{MSP_GCC_ROOT}/include/msp430fr5994.ld ") # Add to search path for linker scripts (xx_symbols.ld, included by main linker script) link_directories( - $ENV{MSP430_GCC_ROOT}/include - $ENV{MSP430_GCC_ROOT}/msp430-elf/lib/430/ - $ENV{MSP430_GCC_ROOT}/lib/gcc/msp430-elf/7.3.1/430 + $ENV{MSP_GCC_ROOT}/include + $ENV{MSP_GCC_ROOT}/msp430-elf/lib/ + $ENV{MSP_GCC_ROOT}/lib/gcc/msp430-elf/7.3.2/ ) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ccf3db33d050df76dc5a5057ce6eddc3db3f7d99..922e3434f5d685d709e245bbc88a546675042178 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,17 +8,21 @@ project(radio_power_test) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include_directories( - ${MSP_GCC_ROOT}/include + $ENV{MSP_GCC_ROOT}/include ${CMAKE_SOURCE_DIR} + ${CMAKE_CURRENT_LIST_DIR} ) link_directories( - ${MSP_GCC_ROOT}/include + $ENV{MSP_GCC_ROOT}/include ) +# See if even the minimal will compile. +add_executable(${PROJECT_NAME}_min test/min.c lib/hal_mcu/hal_mcu.c) +target_link_libraries(${PROJECT_NAME}_min) -add_executable(${PROJECT_NAME}_rxer test/main_txer.c) -target_link_libraries(${PROJECT_NAME}_rxer hal_mcu ) +add_executable(${PROJECT_NAME}_rxer test/LaunchPad_trx_main.c test/LaunchPad_trx_demo.c) +target_link_libraries(${PROJECT_NAME}_rxer hal_mcu radio_drv) -add_executable(${PROJECT_NAME}_txer test/main_rxer.c) -target_compile_definitions(${PROJECT_NAME}_rxer PUBLIC TXER) -target_link_libraries(${PROJECT_NAME}_txer hibernus zeta util spi) +# add_executable(${PROJECT_NAME}_txer test/main_rxer.c) +# target_compile_definitions(${PROJECT_NAME}_rxer PUBLIC TXER) +# target_link_libraries(${PROJECT_NAME}_txer hibernus zeta util spi) diff --git a/source/test/min.c b/source/test/min.c new file mode 100644 index 0000000000000000000000000000000000000000..23d216c02657358e0b150de4b5f253c9043efc6a --- /dev/null +++ b/source/test/min.c @@ -0,0 +1,123 @@ +#include "msp430.h" +#include "stdio.h" +#include "lib/radio_drv/radio_drv.h" +#include "lib/radio_drv/cc1x_utils.h" +#include "lib/radio_drv/hal_spi_rf.h" +#include "lib/uart_drv/uart_drv.h" +#include "LaunchPad_trx_demo.h" + +/****************************************************************************** + * LOCAL FUNCTIONS + */ +extern void msp_setup(void); +extern unsigned long volatile time_counter; + +/****************************************************************************** + * GLOBALS + */ +char u_str[UART_BUFF_SIZE]; +unsigned char txBuffer[TX_BUFF_SIZE]; +char user_button_pushed; +unsigned char wakeup_on_wdt; +trx_cfg_struct trx_cfg; + + +/****************************************************************************** + * @fn main + * + * @brief Main GUI application level control loop is implemented in the + * main loop. It is a state machine that cycles thru various states + * during the interactive use by the operator. The presents a text + * based GUI, the user is then promted to type in a command with + * a given set of parameters. The state machine then calls a simpler + * parser that tries to figure out what the user wants to do. + * + * input parameters + * + * @param void + * + * output parameters + * + * @return void + * + */ +enum state_names {IDLE_RESET, WAIT, OPERATE}; +void main (void) +{ + + char idle_counter = 0; + unsigned char u_str_length; + enum state_names state = WAIT; + + /* Stop WDT */ + WDTCTL = WDTPW + WDTHOLD; + + /* Setup MSP specific functions, IO's, timers and WDT */ + //Comes from lib/hal_mcu/hal_mcu.c + msp_setup(); + + /* Initialize the UART port */ + //hal_uart_init(); + + /* enable uart echo function */ + //uart_drv_toggle_echo(); + + /* initialize the radio subsystem */ + //trx_cfg.bit_rate = radio_init(1); + //trx_cfg.bit_rate = trx_cfg.bit_rate * 100; + + // Perform initial setup of the CC radio + //trx_cfg.b_length = TX_BUFF_SIZE; + //rf_default_setup(&trx_cfg); + + /* Configure LED ports */ + // Defined in hal_spi_rf_exp430fr5994 + LED1_PxDIR |= LED1_PIN; + LED2_PxDIR |= LED2_PIN; + LED3_PxDIR |= LED3_PIN; + LED4_PxDIR |= LED4_PIN; + + /* default all LEDs to off */ + HAL_LED1_OFF(); + HAL_LED2_OFF(); + HAL_LED3_OFF(); + HAL_LED4_OFF(); + + /* Generally we use the WDT time wake the statemachine */ + wakeup_on_wdt = 1; + + /* indicator that button has been pressed */ + user_button_pushed = 0; + + /* Infinite loop with a 1 second timer */ + while(1) + { + + /* Put MCU in low power mode, wait for UART and blink LED */ + HAL_LED2_OFF(); + _BIS_SR(LPM0_bits + GIE); + HAL_LED2_ON(); + idle_counter++; + + + /* + * Main loop of state machine + */ + switch(state) + { + /* print the main menu to the UART buffer */ + case WAIT: + if(idle_counter>250){ + state = IDLE_RESET; + } + state = OPERATE; + break; + case OPERATE: + state = OPERATE; + break; + default: + state = WAIT; + break; + } + } +}