Skip to content
Snippets Groups Projects
Commit 8bf5ffaa authored by Edward Longman's avatar Edward Longman
Browse files

Write minimal code for running the MSP. Adjust Paths and options in MakeLists...

Write minimal code for running the MSP. Adjust Paths and options in MakeLists to ensure correct build
parent 8d12af21
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,6 @@ enable_language(C) ...@@ -10,7 +10,6 @@ enable_language(C)
include_directories($ENV{MSP_GCC_ROOT}/include) # MSP430 headers include_directories($ENV{MSP_GCC_ROOT}/include) # MSP430 headers
add_compile_options( add_compile_options(
-std=c99 -std=c99
-mcpu=msp430
-mmcu=msp430fr5994 -mmcu=msp430fr5994
-msmall -msmall
-mhwmult=none -mhwmult=none
...@@ -19,12 +18,12 @@ add_compile_options( ...@@ -19,12 +18,12 @@ add_compile_options(
) )
# Linker scripts # Linker scripts
#set(CMAKE_EXE_LINKER_FLAGS set(CMAKE_EXE_LINKER_FLAGS
# "${CMAKE_EXE_LINKER_FLAGS} -T ${CMAKE_SOURCE_DIR}/../msp430fr5994.ld ") "${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) # Add to search path for linker scripts (xx_symbols.ld, included by main linker script)
link_directories( link_directories(
$ENV{MSP430_GCC_ROOT}/include $ENV{MSP_GCC_ROOT}/include
$ENV{MSP430_GCC_ROOT}/msp430-elf/lib/430/ $ENV{MSP_GCC_ROOT}/msp430-elf/lib/
$ENV{MSP430_GCC_ROOT}/lib/gcc/msp430-elf/7.3.1/430 $ENV{MSP_GCC_ROOT}/lib/gcc/msp430-elf/7.3.2/
) )
...@@ -8,17 +8,21 @@ project(radio_power_test) ...@@ -8,17 +8,21 @@ project(radio_power_test)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include_directories( include_directories(
${MSP_GCC_ROOT}/include $ENV{MSP_GCC_ROOT}/include
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_LIST_DIR}
) )
link_directories( 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) add_executable(${PROJECT_NAME}_rxer test/LaunchPad_trx_main.c test/LaunchPad_trx_demo.c)
target_link_libraries(${PROJECT_NAME}_rxer hal_mcu ) target_link_libraries(${PROJECT_NAME}_rxer hal_mcu radio_drv)
add_executable(${PROJECT_NAME}_txer test/main_rxer.c) # add_executable(${PROJECT_NAME}_txer test/main_rxer.c)
target_compile_definitions(${PROJECT_NAME}_rxer PUBLIC TXER) # target_compile_definitions(${PROJECT_NAME}_rxer PUBLIC TXER)
target_link_libraries(${PROJECT_NAME}_txer hibernus zeta util spi) # target_link_libraries(${PROJECT_NAME}_txer hibernus zeta util spi)
#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;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment