[ Please excuse the delay. It took a while to get
something worth posting sorted out. ]
On 04/03/2016 14:46, Sambeet Panigrahi wrote:
I wanted to build a hello world image of RTEMS using cmake. Can someone
provide me steps for doing so or point me to the right resources ?
I attach a couple of files from a friend of mine, Andi, who knows and
works with cmake. I have not tried them and I do not know if they work.
If you have any questions please feel free to ask.
Chris
cmake_minimum_required(VERSION 2.8.11)
set(RTEMS_ROOT_PATH "/home/andi/development/rtems")
set(RTEMS_TOOLS_INSTALL_DIR "${RTEMS_ROOT_PATH}/4.12")
set(RTEMS_TOOLS_BSP_LIB_DIR "${RTEMS_ROOT_PATH}/4.12/sparc-rtems4.12/lib")
set(RTEMS_KERNEL_INSTALL_DIR "${RTEMS_ROOT_PATH}/sparc-sis")
set(RTEMS_KERNEL_BSP_LIB_DIR
"${RTEMS_ROOT_PATH}/sparc-sis/sparc-rtems4.12/sis/lib")
set(ENV{PATH} "${RTEMS_TOOLS_INSTALL_DIR}/bin:$ENV{PATH}")
set(RTEMS_TOOLS_BSP_INCLUDE_DIR "${RTEMS_TOOLS_BSP_LIB_DIR}/include")
set(RTEMS_KERNEL_BSP_INCLUDE_DIR "${RTEMS_KERNEL_BSP_LIB_DIR}/include")
set(RTEMS_COMPILE_OPTIONS "-B${RTEMS_KERNEL_BSP_LIB_DIR}
-B${RTEMS_TOOLS_BSP_LIB_DIR} -specs bsp_specs -qrtems -mcpu=cypress")
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR sparc)
cmake_force_c_compiler("${RTEMS_TOOLS_INSTALL_DIR}/bin/sparc-rtems4.12-gcc"
GNU)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "")
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug RelWithDebInfo
Release)
set(CMAKE_C_FLAGS_DEBUG "${RTEMS_COMPILE_OPTIONS} -g"
CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${RTEMS_COMPILE_OPTIONS} -g -O2"
CACHE STRING "")
set(CMAKE_C_FLAGS_RELEASE "${RTEMS_COMPILE_OPTIONS} -O2 -DNDEBUG"
CACHE STRING "")
project(hello)
add_executable(HELLO hello.c)
target_include_directories(HELLO BEFORE PRIVATE
${RTEMS_TOOLS_BSP_INCLUDE_DIR}
${RTEMS_KERNEL_BSP_INCLUDE_DIR})
/*
* Classic API Hello World
*/
#include <rtems.h>
#include <stdlib.h>
#include <stdio.h>
rtems_task Init(rtems_task_argument argument);
rtems_task Init(rtems_task_argument argument)
{
printf( "Hello there from rtems_task Init with arg %d\n", argument);
exit( 0 );
}
/* configuration information */
#include <bsp.h>
/* NOTICE: the clock driver is explicitly disabled */
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */
_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel