Pagina 1 di 1
cmake
Inviato: mer 26 gen 2011, 13:22
da pino_otto
qualcuno sa usare cmake?
devo fare delle modifiche ad un file CMakeLists per fare la cross-compilazione di un programma su mipsel (OpenWrt)
se qualcuno mi puo' aiutare, e' il benvenuto
Re: cmake
Inviato: mer 26 gen 2011, 19:16
da mcosta
Credo di essere in grado di aiutarti.
CMake ha il pregio di essere potentissimo ma allo stesso tempo facile da utilizzare.
Re: cmake
Inviato: mer 26 gen 2011, 20:51
da metrofox
Bhè, esponi il problema

Re: cmake
Inviato: gio 27 gen 2011, 19:04
da pino_otto
L'attivita' che vorrei fare e' la seguente.
Esiste una libreria in C per comandare i chip zigbee XBee. La libreria si chiama libgbee:
http://sourceforge.net/projects/libgbee/
Vorrei fare il porting di questa libreria per OpenWrt con architettura mipsel.
Qui si puo' scaricare l'SDK per OpenWrt (kamikaze):
http://downloads.openwrt.org/kamikaze/8 ... 86.tar.bz2
La toolchain e' contenuta nella directory:
OpenWrt-SDK-brcm-2.4-for-Linux-i686/staging_dir/toolchain-mipsel_gcc3.4.6
Per fare il porting, l'autore di libgbee mi ha suggerito quanto segue:
Hi, porting the libgbee to MIPSEL/OpenWRT shouldn't be too difficult. Each libgbee port implements a defined set of operations allowing the libgbee to communicate with the XBee module. The libgbee calls these routines using C-Macros. Check out the gbee-port.h file of an existing port to get an idea what each port needs to implement. For your MIPSEL/OpenWRT port you could start with the existing x86/Linux port: it should build out of the box for your target system. To create a new port, you can copy the files from src/port/x86/linux to a new directory, e.g. src/port/mips/linux. Edit the file src/port/mips/linux/CMakeLists.inc to invoke your cross-compiler (check out the CMakeLists.inc for the AT91SAM7 port for an example). Now build your libgbee, see doc/build-instructions.pdf for more information. Hope this helps... please tell me if it works. Best regards, Daniel
Questo e' il file CMakeLists.inc che dovrei modificare per addattarlo alla toolchain mipsel:
Codice: Seleziona tutto
# Add source files for the port
set(PORT_SOURCES "src/port/at91sam7/freertos/gbee-port.c")
# Set include directory for the port
include_directories(src/port/at91sam7/freertos)
# Set toolchain for the port
find_program(
ARM_ELF_GCC_PATH "arm-elf-gcc"
PATHS "/usr/local"
"${CMAKE_INSTALL_PREFIX}"
PATH_SUFFIXES "arm/bin")
set(CMAKE_C_COMPILER ${ARM_ELF_GCC_PATH})
# Find FreeRTOS include path
set(
FREE_RTOS_PORT_NAME "ARM7_AT91SAM7S"
CACHE
STRING
"Name of the FreeRTOS port to use, e.g. ARM7_AT91SAM7S")
find_path(
FREERTOS_INCLUDE_PATH "FreeRTOS.h"
PATHS "${CMAKE_INSTALL_PREFIX}"
PATH_SUFFIXES "FreeRTOS"
"include/FreeRTOS"
"FreeRTOS/Source/include")
# Set FreeRTOS include path
include_directories(${FREERTOS_INCLUDE_PATH})
include_directories(${FREERTOS_INCLUDE_PATH}/portable/GCC/${FREE_RTOS_PORT_NAME})
# Find AT91LIB include path
set(
AT91LIB_BOARD_NAME "at91sam7x-ek"
CACHE
STRING
"Exact name of the board, e.g. at91sam7x-ek")
set(
AT91LIB_CHIP_NAME "at91sam7x256"
CACHE
STRING
"Exact name of the MCU, e.g. at91sam7x256")
find_path(
AT91LIB_INCLUDE_PATH "board.h"
PATHS "${CMAKE_INSTALL_PREFIX}"
PATH_SUFFIXES "at91lib/boards/${AT91LIB_BOARD_NAME}"
"include/at91lib/boards/${AT91LIB_BOARD_NAME}")
# Set AT91LIB include path
include_directories(${AT91LIB_INCLUDE_PATH})
include_directories("${AT91LIB_INCLUDE_PATH}/../..")
# Set AT91LIB-specific compiler settings
set(PORT_COMPILE_FLAGS "-mlong-calls -mcpu=arm7tdmi -fomit-frame-pointer -fno-strict-aliasing -mthumb-interwork")
add_definitions("-DTHUMB_INTERWORK -D${AT91LIB_CHIP_NAME}")
Avrei bisogno di aiuto per capire esattamente come devo modificare questo file.