diff --git a/Makefile b/Makefile index 5faf28c..fe881dc 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ TARGETS := stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/l0 stm32/l1 TARGETS += lpc/lpc13xx lpc/lpc17xx #lpc/lpc43xx TARGETS += tiva/lm3s tiva/lm4f TARGETS += efm32/efm32tg efm32/efm32g efm32/efm32lg efm32/efm32gg +TARGETS += vf6xx # Be silent per default, but 'make V=1' will show all compiler calls. ifneq ($(V),1) diff --git a/examples/vf6xx/colibri-vf61/Makefile.include b/examples/vf6xx/colibri-vf61/Makefile.include new file mode 100644 index 0000000..a9efe1e --- /dev/null +++ b/examples/vf6xx/colibri-vf61/Makefile.include @@ -0,0 +1,32 @@ +## +## This file is part of the libopencm3 project. +## +## Copyright (C) 2009 Uwe Hermann +## Copyright (C) 2010 Piotr Esden-Tempski +## Copyright (C) 2011 Fergus Noble +## Copyright (C) 2014 Stefan Agner +## +## This library is free software: you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This library 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. See the +## GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this library. If not, see . +## + +LIBNAME = opencm3_vf6xx +DEFS = -DVF6XX + +FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16 +ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS) + +include ../../../Makefile.rules + + + diff --git a/examples/vf6xx/colibri-vf61/colibri-vf61.ld b/examples/vf6xx/colibri-vf61/colibri-vf61.ld new file mode 100644 index 0000000..2b1a7fc --- /dev/null +++ b/examples/vf6xx/colibri-vf61/colibri-vf61.ld @@ -0,0 +1,38 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2009 Uwe Hermann + * Copyright (C) 2014 Stefan Agner + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library 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. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for Colibri VF61 (Vybrid VF610, use sysRAM0, 512KiB). */ + +/* Define memory regions. */ +MEMORY +{ + /* + * Note: 0x1f000000 is an alias for code bus to the same memory + * located at 0x3f000000, hence start with the data section + * at an offset of 256KiB. One can define this section lenghts + * freely + */ + pc_ram (rwx) : ORIGIN = 0x1f000000, LENGTH = 256K + ps_ram (rwx) : ORIGIN = 0x3f040000, LENGTH = 256K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_vf6xx.ld + diff --git a/examples/vf6xx/colibri-vf61/uart/Makefile b/examples/vf6xx/colibri-vf61/uart/Makefile new file mode 100644 index 0000000..e104a74 --- /dev/null +++ b/examples/vf6xx/colibri-vf61/uart/Makefile @@ -0,0 +1,26 @@ +## +## This file is part of the libopencm3 project. +## +## Copyright (C) 2009 Uwe Hermann +## Copyright (C) 2014 Stefan Agner +## +## This library is free software: you can redistribute it and/or modify +## it under the terms of the GNU Lesser General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This library 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. See the +## GNU Lesser General Public License for more details. +## +## You should have received a copy of the GNU Lesser General Public License +## along with this library. If not, see . +## + +BINARY = uart + +LDSCRIPT = ../colibri-vf61.ld + +include ../Makefile.include + diff --git a/examples/vf6xx/colibri-vf61/uart/uart.c b/examples/vf6xx/colibri-vf61/uart/uart.c new file mode 100644 index 0000000..3f32908 --- /dev/null +++ b/examples/vf6xx/colibri-vf61/uart/uart.c @@ -0,0 +1,73 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2009 Uwe Hermann + * Copyright (C) 2014 Stefan Agner + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library 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. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#include +#include +#include +#include +#include + +int _write(int file, char *ptr, int len); + +int _write(int file, char *ptr, int len) +{ + int i; + + if (file == 1) { + for (i = 0; i < len; i++) + uart_send_blocking(UART2, ptr[i]); + return i; + } + + errno = EIO; + return -1; +} + +static void uart_init(void) +{ + ccm_clock_gate_enable(CG9_UART2); + uart_enable(UART2); + uart_set_baudrate(UART2, 115200); +} + +int main(void) +{ + int counter = 0; + float fcounter = 0.0; + double dcounter = 0.0; + + ccm_calculate_clocks(); + uart_init(); + + /* + * Write Hello World an integer, float and double all over + * again while incrementing the numbers. + */ + while (1) { + printf("Hello World! %i %f %f\r\n", counter, fcounter, + dcounter); + counter++; + fcounter += 0.01; + dcounter += 0.01; + } + + return 0; +} +