From c256eaabbac06f3fa1c84b41af2dfcaab8c42741 Mon Sep 17 00:00:00 2001 From: Bhuvanchandra DV Date: Wed, 22 Jun 2016 13:59:03 +0530 Subject: examples: vf6xx_colibri_m4: Add UART and GPIO example code Add hello_world and gpio example code. Signed-off-by: Bhuvanchandra DV --- examples/vf6xx_colibri_m4/FreeRTOSConfig.h | 166 +++++++++++++++++++++ .../demo_apps/gpio_sample/armgcc/CMakeLists.txt | 152 +++++++++++++++++++ .../demo_apps/gpio_sample/armgcc/build_all.bat | 5 + .../demo_apps/gpio_sample/armgcc/build_all.sh | 5 + .../demo_apps/gpio_sample/armgcc/build_debug.bat | 3 + .../demo_apps/gpio_sample/armgcc/build_debug.sh | 3 + .../demo_apps/gpio_sample/armgcc/build_release.bat | 3 + .../demo_apps/gpio_sample/armgcc/build_release.sh | 3 + .../demo_apps/gpio_sample/armgcc/clean.bat | 3 + .../demo_apps/gpio_sample/armgcc/clean.sh | 3 + .../vf6xx_colibri_m4/demo_apps/gpio_sample/main.c | 92 ++++++++++++ .../demo_apps/hello_world/armgcc/CMakeLists.txt | 152 +++++++++++++++++++ .../demo_apps/hello_world/armgcc/build_all.bat | 5 + .../demo_apps/hello_world/armgcc/build_all.sh | 5 + .../demo_apps/hello_world/armgcc/build_debug.bat | 3 + .../demo_apps/hello_world/armgcc/build_debug.sh | 3 + .../demo_apps/hello_world/armgcc/build_release.bat | 3 + .../demo_apps/hello_world/armgcc/build_release.sh | 3 + .../demo_apps/hello_world/armgcc/clean.bat | 3 + .../demo_apps/hello_world/armgcc/clean.sh | 3 + .../vf6xx_colibri_m4/demo_apps/hello_world/main.c | 69 +++++++++ 21 files changed, 687 insertions(+) create mode 100644 examples/vf6xx_colibri_m4/FreeRTOSConfig.h create mode 100644 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/CMakeLists.txt create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.sh create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.sh create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.sh create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.sh create mode 100644 examples/vf6xx_colibri_m4/demo_apps/gpio_sample/main.c create mode 100644 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.sh create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.sh create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.sh create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.bat create mode 100755 examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.sh create mode 100644 examples/vf6xx_colibri_m4/demo_apps/hello_world/main.c diff --git a/examples/vf6xx_colibri_m4/FreeRTOSConfig.h b/examples/vf6xx_colibri_m4/FreeRTOSConfig.h new file mode 100644 index 0000000..ea1979b --- /dev/null +++ b/examples/vf6xx_colibri_m4/FreeRTOSConfig.h @@ -0,0 +1,166 @@ +/* + FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + All rights reserved + + VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. + + *************************************************************************** + * * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that has become a de facto standard. * + * * + * Help yourself get started quickly and support the FreeRTOS * + * project by purchasing a FreeRTOS tutorial book, reference * + * manual, or both from: http://www.FreeRTOS.org/Documentation * + * * + * Thank you! * + * * + *************************************************************************** + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. + + >>! NOTE: The modification to the GPL is included to allow you to distribute + >>! a combined work that includes FreeRTOS without being obliged to provide + >>! the source code for proprietary components outside of the FreeRTOS + >>! kernel. + + FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. Full license text is available from the following + link: http://www.freertos.org/a00114.html + + 1 tab == 4 spaces! + + *************************************************************************** + * * + * Having a problem? Start by reading the FAQ "My application does * + * not run, what could be wrong?" * + * * + * http://www.FreeRTOS.org/FAQHelp.html * + * * + *************************************************************************** + + http://www.FreeRTOS.org - Documentation, books, training, latest versions, + license and Real Time Engineers Ltd. contact details. + + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, + including FreeRTOS+Trace - an indispensable productivity tool, a DOS + compatible FAT file system, and our tiny thread aware UDP/IP stack. + + http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High + Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and middleware. + + http://www.SafeRTOS.com - High Integrity Systems also provide a safety + engineered and independently SIL3 certified version for use in safety and + mission critical applications that require provable dependability. + + 1 tab == 4 spaces! +*/ + + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +/* Ensure stdint is only used by the compiler, and not the assembler. */ +#ifdef __ICCARM__ + #include +#endif + +#include +#include + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configCPU_CLOCK_HZ ccmPlatformBusClk +#define configTICK_RATE_HZ ((TickType_t)1000) +#define configMAX_PRIORITIES (5) +#define configMINIMAL_STACK_SIZE ((unsigned short)128) +#define configTOTAL_HEAP_SIZE ((size_t)(10 * 1024)) +#define configMAX_TASK_NAME_LEN (10) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 8 +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_MALLOC_FAILED_HOOK 0 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configGENERATE_RUN_TIME_STATS 0 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES (2) + +/* Software timer definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (2) +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 + +/* Cortex-M specific definitions. */ +#ifdef __NVIC_PRIO_BITS + /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ + #define configPRIO_BITS __NVIC_PRIO_BITS +#else + #define configPRIO_BITS 4 /* 15 priority levels */ +#endif + +/* The lowest interrupt priority that can be used in a call to a "set priority" +function. */ +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf + +/* The highest interrupt priority that can be used by any interrupt service +routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL +INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER +PRIORITY THAN THIS! (higher priorities are lower numeric values. */ +#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1 + +/* Interrupt priorities used by the kernel port layer itself. These are generic +to all Cortex-M ports, and do not rely on any particular library functions. */ +#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) +/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! +See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) + +/* Normal assert() semantics without relying on the provision of an assert.h +header file. */ +#define configASSERT(x) if((x) == 0) {taskDISABLE_INTERRUPTS(); for(;;);} + +/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS +standard names. */ +#define vPortSVCHandler SVC_Handler +#define xPortPendSVHandler PendSV_Handler +#define xPortSysTickHandler SysTick_Handler + +#endif /* FREERTOS_CONFIG_H */ diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/CMakeLists.txt b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/CMakeLists.txt new file mode 100644 index 0000000..c580c64 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/CMakeLists.txt @@ -0,0 +1,152 @@ +INCLUDE(CMakeForceCompiler) + +# CROSS COMPILER SETTING +SET(CMAKE_SYSTEM_NAME Generic) +CMAKE_MINIMUM_REQUIRED (VERSION 2.6) + +# THE VERSION NUMBER +SET (Tutorial_VERSION_MAJOR 1) +SET (Tutorial_VERSION_MINOR 0) + +# ENABLE ASM +ENABLE_LANGUAGE(ASM) + +SET(CMAKE_STATIC_LIBRARY_PREFIX) +SET(CMAKE_STATIC_LIBRARY_SUFFIX) + +SET(CMAKE_EXECUTABLE_LIBRARY_PREFIX) +SET(CMAKE_EXECUTABLE_LIBRARY_SUFFIX) + + +# CURRENT DIRECTORY +SET(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR}) + +# DEBUG LINK FILE +#set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_tcm.ld -static") + +# RELEASE LINK FILE +#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_tcm.ld -static") + +# DEBUG LINK FILE +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_sysram-sram.ld -static") + +# RELEASE LINK FILE +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_sysram-sram.ld -static") + +# DEBUG ASM FLAGS +SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -g -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# DEBUG C FLAGS +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# DEBUG LD FLAGS +SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x400 -Xlinker --defsym=__heap_size__=0x200") + +# RELEASE ASM FLAGS +SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# RELEASE C FLAGS +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# RELEASE LD FLAGS +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x400 -Xlinker --defsym=__heap_size__=0x200") + +# ASM MACRO +SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -D__DEBUG") + +# C MACRO +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__DEBUG") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCPU_VF6XX_M4") +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D__NDEBUG") +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DCPU_VF6XX_M4") + +# CXX MACRO + +# INCLUDE_DIRECTORIES +IF(CMAKE_BUILD_TYPE MATCHES Debug) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/CMSIS/Include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/startup) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/drivers/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/utilities/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) +ELSEIF(CMAKE_BUILD_TYPE MATCHES Release) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/CMSIS/Include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/startup) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/drivers/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/utilities/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) +ENDIF() + +# ADD_EXECUTABLE +ADD_EXECUTABLE(gpio_sample + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h" + "${ProjDirPath}/../../../../../platform/devices/VF6XX/startup/gcc/startup_VF6XX_M4.S" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/MemMang/heap_2.c" + "${ProjDirPath}/../../../FreeRTOSConfig.h" + "${ProjDirPath}/../main.c" + "${ProjDirPath}/../../../../../platform/drivers/src/lpuart_vf6xx.c" + "${ProjDirPath}/../../../../../platform/drivers/inc/lpuart_vf6xx.h" + "${ProjDirPath}/../../../../../platform/drivers/src/ccm_vf6xx.c" + "${ProjDirPath}/../../../../../platform/drivers/inc/ccm_vf6xx.h" + "${ProjDirPath}/../../../../../platform/drivers/src/gpio_vf6xx.c" + "${ProjDirPath}/../../../../../platform/drivers/inc/gpio_vf6xx.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/croutine.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/event_groups.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/FreeRTOS.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/list.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/mpu_wrappers.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/portable.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/projdefs.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/queue.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/semphr.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/StackMacros.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/task.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/timers.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/croutine.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/event_groups.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/list.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/queue.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/tasks.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/timers.c" + "${ProjDirPath}/../../../../../platform/utilities/src/debug_console.c" + "${ProjDirPath}/../../../../../platform/utilities/inc/debug_console.h" + "${ProjDirPath}/../../../../../platform/utilities/src/debug_console_vf6xx.c" + "${ProjDirPath}/../../../../../platform/utilities/inc/debug_console_vf6xx.h" + "${ProjDirPath}/../../../../../platform/utilities/src/print_scan.c" + "${ProjDirPath}/../../../../../platform/utilities/src/print_scan.h" + "${ProjDirPath}/../../../../../platform/devices/VF6XX/startup/system_VF6XX_M4.c" + "${ProjDirPath}/../../../../../platform/devices/VF6XX/startup/system_VF6XX_M4.h" +) +SET_TARGET_PROPERTIES(gpio_sample PROPERTIES OUTPUT_NAME "gpio_sample.elf") + +TARGET_LINK_LIBRARIES(gpio_sample -Wl,--start-group) +# LIBRARIES +IF(CMAKE_BUILD_TYPE MATCHES Debug) +ELSEIF(CMAKE_BUILD_TYPE MATCHES Release) +ENDIF() + +# SYSTEM LIBRARIES +TARGET_LINK_LIBRARIES(gpio_sample m) +TARGET_LINK_LIBRARIES(gpio_sample c) +TARGET_LINK_LIBRARIES(gpio_sample gcc) +TARGET_LINK_LIBRARIES(gpio_sample nosys) +TARGET_LINK_LIBRARIES(gpio_sample -Wl,--end-group) + +# MAP FILE +SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker -Map=debug/gpio_sample.map") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker -Map=release/gpio_sample.map") + +# BIN AND HEX +ADD_CUSTOM_COMMAND(TARGET gpio_sample POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex ${EXECUTABLE_OUTPUT_PATH}/gpio_sample.elf ${EXECUTABLE_OUTPUT_PATH}/gpio_sample.hex) +ADD_CUSTOM_COMMAND(TARGET gpio_sample POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary ${EXECUTABLE_OUTPUT_PATH}/gpio_sample.elf ${EXECUTABLE_OUTPUT_PATH}/gpio_sample.bin) diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.bat b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.bat new file mode 100755 index 0000000..6d41d86 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.bat @@ -0,0 +1,5 @@ +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug . +mingw32-make -j4 +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release . +mingw32-make -j4 +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.sh b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.sh new file mode 100755 index 0000000..ebb0c25 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_all.sh @@ -0,0 +1,5 @@ +#!/bin/sh +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug . +make -j4 +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release . +make -j4 diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.bat b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.bat new file mode 100755 index 0000000..bf3b902 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.bat @@ -0,0 +1,3 @@ +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug . +mingw32-make -j4 +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.sh b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.sh new file mode 100755 index 0000000..571868b --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_debug.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug . +make -j4 diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.bat b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.bat new file mode 100755 index 0000000..e229a83 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.bat @@ -0,0 +1,3 @@ +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release . +mingw32-make -j4 +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.sh b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.sh new file mode 100755 index 0000000..035ce4e --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/build_release.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release . +make -j4 diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.bat b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.bat new file mode 100755 index 0000000..ffea088 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.bat @@ -0,0 +1,3 @@ +RD /s /Q Debug Release CMakeFiles +DEL /s /Q /F Makefile cmake_install.cmake CMakeCache.txt +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.sh b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.sh new file mode 100755 index 0000000..795ad87 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/armgcc/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh +rm -rf debug release CMakeFiles +rm -rf Makefile cmake_install.cmake CMakeCache.txt diff --git a/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/main.c b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/main.c new file mode 100644 index 0000000..ae22319 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/gpio_sample/main.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * Copyright (c) 2016, Toradex AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of Freescale Semiconductor, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include "debug_console_vf6xx.h" + +struct hello_world { + const char *text; + int delay; +}; + +static struct hello_world task_a = { + .text = "Hello, World!\r\n", + .delay = 700, +}; + +void switch_task(void *p) +{ + struct hello_world *data = (struct hello_world *)p; + + for (;;) { + if (GPIO_ReadPinInput(GPIO(38), 38)) + PRINTF(data->text); + + vTaskDelay(data->delay); + } +} + +void led_toggle_task(void *p) +{ + for (;;) { + GPIO_TogglePinOutput(GPIO(39), 39, gpioPinSet); + + vTaskDelay(500); + } +} + +int main(void) +{ + /* Init Clock Control and UART */ + CCM_GetClocks(); + CCM_ControlGate(ccmCcgrGateUart2, ccmClockNeededAll); + + vf6xx_DbgConsole_Init(UART2, ccmIpgBusClk, 115200); + + gpio_init_t ledIn = {.pin = 38, .direction = gpioDigitalInput}; + gpio_init_t ledOut = {.pin = 39, .direction = gpioDigitalOutput}; + GPIO_Init(GPIO(38), &ledIn); + GPIO_Init(GPIO(39), &ledOut); + + xTaskCreate(switch_task, "Task A", configMINIMAL_STACK_SIZE, + &task_a, tskIDLE_PRIORITY, NULL); + + xTaskCreate(led_toggle_task, "Task B", configMINIMAL_STACK_SIZE, + &task_a, tskIDLE_PRIORITY, NULL); + + vTaskStartScheduler(); + + while (true); +} diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt new file mode 100644 index 0000000..741b0c6 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/CMakeLists.txt @@ -0,0 +1,152 @@ +INCLUDE(CMakeForceCompiler) + +# CROSS COMPILER SETTING +SET(CMAKE_SYSTEM_NAME Generic) +CMAKE_MINIMUM_REQUIRED (VERSION 2.6) + +# THE VERSION NUMBER +SET (Tutorial_VERSION_MAJOR 1) +SET (Tutorial_VERSION_MINOR 0) + +# ENABLE ASM +ENABLE_LANGUAGE(ASM) + +SET(CMAKE_STATIC_LIBRARY_PREFIX) +SET(CMAKE_STATIC_LIBRARY_SUFFIX) + +SET(CMAKE_EXECUTABLE_LIBRARY_PREFIX) +SET(CMAKE_EXECUTABLE_LIBRARY_SUFFIX) + + +# CURRENT DIRECTORY +SET(ProjDirPath ${CMAKE_CURRENT_SOURCE_DIR}) + +# DEBUG LINK FILE +#set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_tcm.ld -static") + +# RELEASE LINK FILE +#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_tcm.ld -static") + +# DEBUG LINK FILE +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_sysram-sram.ld -static") + +# RELEASE LINK FILE +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -T${ProjDirPath}/../../../../../platform/devices/VF6XX/linker/gcc/vf6xx_sysram-sram.ld -static") + +# DEBUG ASM FLAGS +SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -g -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# DEBUG C FLAGS +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# DEBUG LD FLAGS +SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x400 -Xlinker --defsym=__heap_size__=0x200") + +# RELEASE ASM FLAGS +SET(CMAKE_ASM_FLAGS_RELEASE "${CMAKE_ASM_FLAGS_RELEASE} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# RELEASE C FLAGS +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -MMD -MP -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mapcs -std=gnu99") + +# RELEASE LD FLAGS +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nano.specs -lm -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -Os -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker --defsym=__stack_size__=0x400 -Xlinker --defsym=__heap_size__=0x200") + +# ASM MACRO +SET(CMAKE_ASM_FLAGS_DEBUG "${CMAKE_ASM_FLAGS_DEBUG} -D__DEBUG") + +# C MACRO +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__DEBUG") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCPU_VF6XX_M4") +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D__NDEBUG") +SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DCPU_VF6XX_M4") + +# CXX MACRO + +# INCLUDE_DIRECTORIES +IF(CMAKE_BUILD_TYPE MATCHES Debug) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/CMSIS/Include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/startup) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/drivers/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/utilities/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) +ELSEIF(CMAKE_BUILD_TYPE MATCHES Release) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/CMSIS/Include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/devices/VF6XX/startup) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/drivers/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../../../../platform/utilities/inc) + INCLUDE_DIRECTORIES(${ProjDirPath}/../../..) +ENDIF() + +# ADD_EXECUTABLE +ADD_EXECUTABLE(hello_world + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h" + "${ProjDirPath}/../../../../../platform/devices/VF6XX/startup/gcc/startup_VF6XX_M4.S" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/portable/MemMang/heap_2.c" + "${ProjDirPath}/../../../FreeRTOSConfig.h" + "${ProjDirPath}/../main.c" + "${ProjDirPath}/../../../../../platform/drivers/src/lpuart_vf6xx.c" + "${ProjDirPath}/../../../../../platform/drivers/inc/lpuart_vf6xx.h" + "${ProjDirPath}/../../../../../platform/drivers/src/ccm_vf6xx.c" + "${ProjDirPath}/../../../../../platform/drivers/inc/ccm_vf6xx.h" + "${ProjDirPath}/../../../../../platform/drivers/src/gpio_vf6xx.c" + "${ProjDirPath}/../../../../../platform/drivers/inc/gpio_vf6xx.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/croutine.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/event_groups.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/FreeRTOS.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/list.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/mpu_wrappers.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/portable.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/projdefs.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/queue.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/semphr.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/StackMacros.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/task.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/include/timers.h" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/croutine.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/event_groups.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/list.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/queue.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/tasks.c" + "${ProjDirPath}/../../../../../rtos/FreeRTOS/Source/timers.c" + "${ProjDirPath}/../../../../../platform/utilities/src/debug_console.c" + "${ProjDirPath}/../../../../../platform/utilities/inc/debug_console.h" + "${ProjDirPath}/../../../../../platform/utilities/src/debug_console_vf6xx.c" + "${ProjDirPath}/../../../../../platform/utilities/inc/debug_console_vf6xx.h" + "${ProjDirPath}/../../../../../platform/utilities/src/print_scan.c" + "${ProjDirPath}/../../../../../platform/utilities/src/print_scan.h" + "${ProjDirPath}/../../../../../platform/devices/VF6XX/startup/system_VF6XX_M4.c" + "${ProjDirPath}/../../../../../platform/devices/VF6XX/startup/system_VF6XX_M4.h" +) +SET_TARGET_PROPERTIES(hello_world PROPERTIES OUTPUT_NAME "hello_world.elf") + +TARGET_LINK_LIBRARIES(hello_world -Wl,--start-group) +# LIBRARIES +IF(CMAKE_BUILD_TYPE MATCHES Debug) +ELSEIF(CMAKE_BUILD_TYPE MATCHES Release) +ENDIF() + +# SYSTEM LIBRARIES +TARGET_LINK_LIBRARIES(hello_world m) +TARGET_LINK_LIBRARIES(hello_world c) +TARGET_LINK_LIBRARIES(hello_world gcc) +TARGET_LINK_LIBRARIES(hello_world nosys) +TARGET_LINK_LIBRARIES(hello_world -Wl,--end-group) + +# MAP FILE +SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Xlinker -Map=debug/hello_world.map") +SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Xlinker -Map=release/hello_world.map") + +# BIN AND HEX +ADD_CUSTOM_COMMAND(TARGET hello_world POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex ${EXECUTABLE_OUTPUT_PATH}/hello_world.elf ${EXECUTABLE_OUTPUT_PATH}/hello_world.hex) +ADD_CUSTOM_COMMAND(TARGET hello_world POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary ${EXECUTABLE_OUTPUT_PATH}/hello_world.elf ${EXECUTABLE_OUTPUT_PATH}/hello_world.bin) diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.bat b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.bat new file mode 100755 index 0000000..6d41d86 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.bat @@ -0,0 +1,5 @@ +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug . +mingw32-make -j4 +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release . +mingw32-make -j4 +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.sh b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.sh new file mode 100755 index 0000000..ebb0c25 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_all.sh @@ -0,0 +1,5 @@ +#!/bin/sh +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug . +make -j4 +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release . +make -j4 diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.bat b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.bat new file mode 100755 index 0000000..bf3b902 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.bat @@ -0,0 +1,3 @@ +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug . +mingw32-make -j4 +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.sh b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.sh new file mode 100755 index 0000000..571868b --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_debug.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug . +make -j4 diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.bat b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.bat new file mode 100755 index 0000000..e229a83 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.bat @@ -0,0 +1,3 @@ +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release . +mingw32-make -j4 +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.sh b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.sh new file mode 100755 index 0000000..035ce4e --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/build_release.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cmake -DCMAKE_TOOLCHAIN_FILE="../../../../../tools/cmake_toolchain_files/armgcc.cmake" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release . +make -j4 diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.bat b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.bat new file mode 100755 index 0000000..ffea088 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.bat @@ -0,0 +1,3 @@ +RD /s /Q Debug Release CMakeFiles +DEL /s /Q /F Makefile cmake_install.cmake CMakeCache.txt +pause diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.sh b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.sh new file mode 100755 index 0000000..795ad87 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/armgcc/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh +rm -rf debug release CMakeFiles +rm -rf Makefile cmake_install.cmake CMakeCache.txt diff --git a/examples/vf6xx_colibri_m4/demo_apps/hello_world/main.c b/examples/vf6xx_colibri_m4/demo_apps/hello_world/main.c new file mode 100644 index 0000000..1fad4c2 --- /dev/null +++ b/examples/vf6xx_colibri_m4/demo_apps/hello_world/main.c @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * Copyright (c) 2016, Toradex AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of Freescale Semiconductor, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include "debug_console_vf6xx.h" + +/*! + * @brief A basic user-defined task + */ +void HelloTask(void *pvParameters) +{ + uint8_t receiveBuff; + /* Print the initial banner */ + PRINTF("\r\nHello World!\n\n\r"); + while(1) { + /* Main routine that simply echoes received characters forever */ + /* First, get character */ + receiveBuff = GETCHAR(); + /* Now echo the received character */ + PUTCHAR(receiveBuff); + } +} + +int main(void) +{ + /* Init Clock Control and UART */ + CCM_GetClocks(); + CCM_ControlGate(ccmCcgrGateUart2, ccmClockNeededAll); + + vf6xx_DbgConsole_Init(UART2, ccmIpgBusClk, 115200); + + xTaskCreate(HelloTask, "Print Task", configMINIMAL_STACK_SIZE, + NULL, tskIDLE_PRIORITY+1, NULL); + + vTaskStartScheduler(); + + while (true); +} -- cgit v1.2.3