Skip to content

Commit

Permalink
Allows to specify chip's silicon revision for TivaWare. (#268)
Browse files Browse the repository at this point in the history
* Improving Hardware class. No more error of multiple static member definitions when including ros.h multiple times.

* Forgot includes on tivac_hardware headers.

* Small correction on write function. May dropped a byte when already sending

* Allow python's socket reuse. Removed RosSerialServer unused method

* As of TivaWare 2.1.3.156, compiling for hard float.

* TivaC optional argument for specifying programmer serial id.

* Allows to specify chip's silicon revision for TivaWare.
  • Loading branch information
vmatos authored and mikepurvis committed Feb 14, 2017
1 parent 1c52038 commit a268e8b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
4 changes: 2 additions & 2 deletions rosserial_tivac/src/ros_lib/startup_gcc.c
Expand Up @@ -67,7 +67,7 @@ extern uint32_t _estack;
// ensure that it ends up at physical address 0x0000.0000.
//
//*****************************************************************************
#ifdef TARGET_IS_TM4C123_RA1
#ifdef TM4C123GXL
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
{
Expand Down Expand Up @@ -228,7 +228,7 @@ void (* const g_pfnVectors[])(void) =
IntDefaultHandler // PWM 1 Fault
};
#endif
#ifdef TARGET_IS_TM4C129_RA0
#ifdef TM4C1294XL
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
{
Expand Down
8 changes: 4 additions & 4 deletions rosserial_tivac/src/ros_lib/tivac_hardware.h
Expand Up @@ -54,14 +54,14 @@ extern "C"

#define SYSTICKHZ 1000UL

#ifdef TARGET_IS_TM4C123_RA1
#ifdef TM4C123GXL
#define LED1 GPIO_PIN_3 // Green LED
#define LED2 GPIO_PIN_2 // Blue LED
#define LED_PORT GPIO_PORTF_BASE
#define LED_PERIPH SYSCTL_PERIPH_GPIOF
#endif

#ifdef TARGET_IS_TM4C129_RA0
#ifdef TM4C1294XL
#define LED1 GPIO_PIN_1 // D1 LED
#define LED2 GPIO_PIN_0 // D2 LED
#define LED_PORT GPIO_PORTN_BASE
Expand All @@ -87,10 +87,10 @@ class TivaCHardware

void init()
{
#ifdef TARGET_IS_TM4C123_RA1
#ifdef TM4C123GXL
this->ui32SysClkFreq = MAP_SysCtlClockGet();
#endif
#ifdef TARGET_IS_TM4C129_RA0
#ifdef TM4C1294XL
this->ui32SysClkFreq = TM4C129FREQ;
#endif

Expand Down
12 changes: 6 additions & 6 deletions rosserial_tivac/src/ros_lib/tivac_hardware_usb.h
Expand Up @@ -59,14 +59,14 @@ extern "C"

#define SYSTICKHZ 1000UL

#ifdef TARGET_IS_TM4C123_RA1
#ifdef TM4C123GXL
#define LED1 GPIO_PIN_3 // Green LED
#define LED2 GPIO_PIN_2 // Blue LED
#define LED_PORT GPIO_PORTF_BASE
#define LED_PERIPH SYSCTL_PERIPH_GPIOF
#endif

#ifdef TARGET_IS_TM4C129_RA0
#ifdef TM4C1294XL
#define LED1 GPIO_PIN_1 // D1 LED
#define LED2 GPIO_PIN_0 // D2 LED
#define LED_PORT GPIO_PORTN_BASE
Expand All @@ -86,10 +86,10 @@ class TivaCHardware

void init()
{
#ifdef TARGET_IS_TM4C123_RA1
#ifdef TM4C123GXL
this->ui32SysClkFreq = MAP_SysCtlClockGet();
#endif
#ifdef TARGET_IS_TM4C129_RA0
#ifdef TM4C1294XL
this->ui32SysClkFreq = TM4C129FREQ;
#endif

Expand All @@ -113,12 +113,12 @@ class TivaCHardware
MAP_SysTickIntEnable();

MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
#ifdef TARGET_IS_TM4C123_RA1
#ifdef TM4C123GXL
// Configure the required pins for USB operation.
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4);
#endif
#ifdef TARGET_IS_TM4C129_RA0
#ifdef TM4C1294XL
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
MAP_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
#endif
Expand Down
25 changes: 20 additions & 5 deletions rosserial_tivac/tivac-cmake/cmake/TivaCToolchain.cmake
Expand Up @@ -14,6 +14,7 @@
# With Arguments:
# USB - Optional argument, if you wish to have rosserial over USB CDC device.
# BOARD - Required. Takes one argument, tm4c123gxl or tm4c1294xl.
# DEVICE_SILICON - Optional argument. Defines the specific chip's silicon revision.
# DEVICE_SERIAL - Optional argument. Creates flash target for specific device.
# STARTUP - Optional argument. Takes the name of custom startup file.
# SRCS - Required. List of source files to compile.
Expand Down Expand Up @@ -94,16 +95,26 @@ include_directories($ENV{TIVA_WARE_PATH})
set(FLASH_EXECUTABLE $ENV{TIVA_FLASH_EXECUTABLE})

# Configures FLAGS
function(CONFIGURE_BOARD BOARD)
function(CONFIGURE_BOARD BOARD DEVICE_SILICON)
message(STATUS "[TIVAC] Configuring board for ${CMAKE_PROJECT_NAME}")

if(${BOARD} STREQUAL "tm4c123gxl")
add_definitions(-DTM4C123GXL)
add_definitions(-DPART_TM4C123GH6PM)
add_definitions(-DTARGET_IS_TM4C123_RA1)
if(DEVICE_SILICON STREQUAL "default")
add_definitions(-DTARGET_IS_TM4C123_RB1)
else()
add_definitions(-D${DEVICE_SILICON})
endif()
set(CMAKE_EXE_LINKER_FLAGS "-T${LINKER_SCRIPT_TM4C123GXL} -specs=${LINKER_SPECS} -Wl,-Map=memmap.map" CACHE STRING "" FORCE)
elseif(${BOARD} STREQUAL "tm4c1294xl")
add_definitions(-DTM4C1294XL)
add_definitions(-DPART_TM4C1294NCPDT)
add_definitions(-DTARGET_IS_TM4C129_RA0)
if(DEVICE_SILICON STREQUAL "default")
add_definitions(-DTARGET_IS_TM4C129_RA1)
else()
add_definitions(-D${DEVICE_SILICON})
endif()
set(CMAKE_EXE_LINKER_FLAGS "-T${LINKER_SCRIPT_TM4C1294XL} -specs=${LINKER_SPECS} -Wl,-Map=memmap.map" CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "${Red}[TIVAC] Invalid BOARD set for target ${CMAKE_PROJECT_NAME}${ColourReset}")
Expand All @@ -115,14 +126,18 @@ endfunction()
function(GENERATE_TIVAC_FIRMWARE)
message(STATUS "[TIVAC] Generating firmware ${CMAKE_PROJECT_NAME}")
set(options USB)
set(oneValueArgs BOARD STARTUP DEVICE_SERIAL)
set(oneValueArgs BOARD STARTUP DEVICE_SILICON DEVICE_SERIAL)
set(multiValueArgs SRCS INCS LIBS)
cmake_parse_arguments(INPUT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(NOT INPUT_BOARD)
message(FATAL_ERROR "${Red}[TIVAC] BOARD not set for target ${CMAKE_PROJECT_NAME}${ColourReset}")
endif()
configure_board(${INPUT_BOARD})
if(NOT INPUT_DEVICE_SILICON)
set(INPUT_DEVICE_SILICON "default")
endif()
configure_board(${INPUT_BOARD} ${INPUT_DEVICE_SILICON})


if(INPUT_USB)
add_definitions(-DUSE_USBCON)
Expand Down

0 comments on commit a268e8b

Please sign in to comment.