Commit 94327927 authored by Erik Jansson's avatar Erik Jansson
Browse files

Porting work to VxWorks begun.

parent 1cb92354
......@@ -21,7 +21,13 @@
#include <stdlib.h>
#include <stdbool.h>
#ifdef LABCOMM_COMPAT
#include LABCOMM_COMPAT
#else
#include <stdint.h>
#endif
/**
* @brief Defines the maximum number of events an event may depend on.
......
......@@ -5,7 +5,7 @@
## General {{{
cmake_minimum_required (VERSION 2.8)
project (Firefly)
project (Firefly C)
if(NOT CMAKE_CROSSCOMPILING)
enable_testing()
endif(NOT CMAKE_CROSSCOMPILING)
......@@ -64,24 +64,37 @@ set(ERR_FLAGS "-Wall -Wextra")
set(MACROS_DEF "-DDEBUG")
if(CMAKE_CROSSCOMPILING)
# CFLAGS when cross compiling to the ARM-card:
set(CMAKE_C_FLAGS
"${C_STD} "
"${ERR_FLAGS} -Wfloat-equal -Werror-implicit-function-declaration "
"-mthumb -mcpu=cortex-m3 -T../ft-sense/src/adc_freertos_lwip/standalone.ld"
"-ffunction-sections -fdata-sections "
"${MACROS_DEF} -DUART_BUFFERED -Dsprintf=usprintf "
"-Dsnprintf=usnprintf -Dvsnprintf=uvsnprintf -Dprintf=uipprintf "
"-DFIREFLY_MALLOC=pvPortMalloc -Dcalloc=pvPortCalloc -DFIREFLY_FREE=vPortFree "
"-DARM_CORTEXM3_CODESOURCERY -DLABCOMM_NO_STDIO "
"-DLABCOMM_COMPAT=\\\"labcomm_compat_arm_cortexm3.h\\\" "
"-DGCC_ARMCM3=1"
)
# Join the list stuff above to a single string:
JOIN("${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
if (VXWORKS_COMPILING)
# CFLAGS when cross compiling to the ARM-card:
set(CMAKE_C_FLAGS
"${C_STD} "
"${ERR_FLAGS} "
"${MACROS_DEF} "
"-DLABCOMM_COMPAT=\\\"labcomm_compat_vxworks.h\\\" "
)
# Join the list stuff above to a single string:
JOIN("${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
else()
# CFLAGS when cross compiling to the ARM-card:
set(CMAKE_C_FLAGS
"${C_STD} "
"${ERR_FLAGS} -Wfloat-equal -Werror-implicit-function-declaration "
"-mthumb -mcpu=cortex-m3 -T../ft-sense/src/adc_freertos_lwip/standalone.ld"
"-ffunction-sections -fdata-sections "
"${MACROS_DEF} -DUART_BUFFERED -Dsprintf=usprintf "
"-Dsnprintf=usnprintf -Dvsnprintf=uvsnprintf -Dprintf=uipprintf "
"-DFIREFLY_MALLOC=pvPortMalloc -Dcalloc=pvPortCalloc -DFIREFLY_FREE=vPortFree "
"-DARM_CORTEXM3_CODESOURCERY -DLABCOMM_NO_STDIO "
"-DLABCOMM_COMPAT=\\\"labcomm_compat_arm_cortexm3.h\\\" "
"-DGCC_ARMCM3=1"
)
# Join the list stuff above to a single string:
JOIN("${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
endif()
else()
# CFLAGS when compiling normally:
set(CMAKE_C_FLAGS "${C_STD} ${ERR_FLAGS} ${MACROS_DEF} -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_STD} ${ERR_FLAGS} ${MACROS_DEF} -g")
endif(CMAKE_CROSSCOMPILING)
## }}}
......
# Set system name to Generic when compiling for embedded systems
# according to CMake manual:
set(CMAKE_SYSTEM_NAME Generic)
set(VXWORKS_COMPILING TRUE)
# Specify the cross compiler:
set(CMAKE_C_COMPILER i586-wrs-vxworks-gcc)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLABCOMM_COMPAT=\\\"labcomm_compat_vxworks.h\\\"")
if(NOT CMAKE_CROSSCOMPILING)
if(NOT CMAKE_CROSSCOMPILING OR VXWORKS_COMPILING)
# Set targets to install
set(transport_install_libs
transport-eth-posix
transport-udp-posix
)
# Ethernet POSIX
add_library(transport-eth-posix
${Firefly_SOURCE_DIR}/transport/firefly_transport.c
${Firefly_SOURCE_DIR}/transport/firefly_transport_eth_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_resend_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_event_queue_posix.c
)
target_link_libraries(transport-eth-posix gen-files)
if (NOT VXWORKS_COMPILING)
# Ethernet POSIX
add_library(transport-eth-posix
${Firefly_SOURCE_DIR}/transport/firefly_transport.c
${Firefly_SOURCE_DIR}/transport/firefly_transport_eth_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_resend_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_event_queue_posix.c
)
set(transport_install_libs
${transport_install_libs}
transport-eth-posix
)
target_link_libraries(transport-eth-posix gen-files)
endif (NOT VXWORKS_COMPILING)
if (XENOMAI_FOUND AND RTNET_FOUND)
include_directories(${XENOMAI_INCLUDE_DIRS} ${RTNET_INCLUDE_DIRS})
......@@ -38,23 +39,35 @@ if(NOT CMAKE_CROSSCOMPILING)
)
endif (XENOMAI_FOUND AND RTNET_FOUND)
# UDP POSIX
add_library(transport-udp-posix
${Firefly_SOURCE_DIR}/transport/firefly_transport.c
${Firefly_SOURCE_DIR}/transport/firefly_transport_udp_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_resend_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_event_queue_posix.c
)
target_link_libraries(transport-udp-posix gen-files)
if (NOT VXWORKS_COMPILING)
# UDP POSIX
add_library(transport-udp-posix
${Firefly_SOURCE_DIR}/transport/firefly_transport.c
${Firefly_SOURCE_DIR}/transport/firefly_transport_udp_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_resend_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_event_queue_posix.c
)
target_link_libraries(transport-udp-posix gen-files)
set(transport_install_libs
${transport_install_libs}
transport-udp-posix
)
endif (NOT VXWORKS_COMPILING)
# TCP POSIX
add_library(transport-tcp-posix
${Firefly_SOURCE_DIR}/transport/firefly_transport.c
${Firefly_SOURCE_DIR}/transport/firefly_transport_tcp_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_resend_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_event_queue_posix.c
)
target_link_libraries(transport-tcp-posix gen-files)
if (NOT VXWORKS_COMPILING)
# TCP POSIX
add_library(transport-tcp-posix
${Firefly_SOURCE_DIR}/transport/firefly_transport.c
${Firefly_SOURCE_DIR}/transport/firefly_transport_tcp_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_resend_posix.c
${Firefly_SOURCE_DIR}/utils/firefly_event_queue_posix.c
)
target_link_libraries(transport-tcp-posix gen-files)
set(transport_install_libs
${transport_install_libs}
transport-tcp-posix
)
endif (NOT VXWORKS_COMPILING)
else()
......@@ -77,7 +90,7 @@ else()
transport-eth-stellaris
transport-udp-lwip
)
endif(NOT CMAKE_CROSSCOMPILING)
endif(NOT CMAKE_CROSSCOMPILING OR VXWORKS_COMPILING)
install(TARGETS ${transport_install_libs}
ARCHIVE DESTINATION lib
......
......@@ -6,7 +6,11 @@
#include <stdlib.h>
#include <stdbool.h>
#ifdef LABCOMM_COMPAT
#include LABCOMM_COMPAT
#else
#include <stdint.h>
#endif
#include <string.h>
#include <utils/firefly_errors.h>
......
......@@ -9,7 +9,12 @@
#include <utils/firefly_event_queue.h>
#include <stdbool.h>
#ifdef LABCOMM_COMPAT
#include LABCOMM_COMPAT
#else
#include <stdint.h>
#endif
/**
* @brief An event queue
......
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment