ARM: get a minimum amount of Teacup compiled for ARM.
Makefile can't even upload, yet.
SIZES ARM... lpc1114
FLASH : 944 bytes 3%
RAM : 132 bytes 4%
EEPROM : 0 bytes 0%
This commit is contained in:
parent
24b2cd1d02
commit
575174940f
|
|
@ -0,0 +1,178 @@
|
|||
##############################################################################
|
||||
# #
|
||||
# Teacup - Lean and efficient firmware for RepRap printers #
|
||||
# #
|
||||
# by Triffid Hunter, Traumflug, jakepoz, many others. #
|
||||
# #
|
||||
# This firmware is Copyright (c) ... #
|
||||
# 2009 - 2010 Michael Moon aka Triffid_Hunter #
|
||||
# 2010 - 2013 Markus "Traumflug" Hitter <mah@jump-ing.de> #
|
||||
# #
|
||||
# This program is free software; you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation; either version 2 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program 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 General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program; if not, write to the Free Software #
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
# Makefile for ARM targets. Use it with #
|
||||
# #
|
||||
# make -f Makefile-ARM #
|
||||
# #
|
||||
# or copy/link it to Makefile for convenience. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
# Change these to suit your hardware #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
MCU ?= lpc1114
|
||||
# MCU ?= atmega328p
|
||||
# MCU ?= atmega644
|
||||
# MCU ?= atmega1284p
|
||||
# MCU ?= atmega1280
|
||||
# MCU ?= atmega2560
|
||||
# MCU ?= at90usb1286
|
||||
# MCU ?= atmega32u4
|
||||
|
||||
# CPU clock rate not defined here, but in the CMSIS headers.
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
# Where to find your compiler and linker. Later, this is completed like #
|
||||
# CC = $(TOOLCHAIN)gcc #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
TOOLCHAIN = arm-none-eabi-
|
||||
# TOOLCHAIN = <path-to-arduino-folder>/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
# Programmer settings for "make program" #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
# avrdude, typical for AVR-based architectures.
|
||||
#
|
||||
# Flags:
|
||||
# -c <programmer-type> Typically stk500 or stk500v2.
|
||||
# -b <baudrate> Upload baud rate. Depends on the bootloader in
|
||||
# use. Not used for USB programmers.
|
||||
# -p <mcu type> See MCU above.
|
||||
# -P <port> Serial port the electronics is connected to.
|
||||
# -C <config file> Optional, default is /etc/avrdude.conf.
|
||||
|
||||
UPLOADER ?= avrdude
|
||||
# UPLOADER = <path-to-arduino-folder>/hardware/tools/avrdude
|
||||
|
||||
ifndef UPLOADER_FLAGS
|
||||
UPLOADER_FLAGS = -c stk500v2
|
||||
# UPLOADER_FLAGS += -b 19200
|
||||
# UPLOADER_FLAGS += -b 57600
|
||||
UPLOADER_FLAGS += -b 115200
|
||||
UPLOADER_FLAGS += -p $(MCU)
|
||||
# UPLOADER_FLAGS += -P COM1
|
||||
# UPLOADER_FLAGS += -P /dev/ttyACM0
|
||||
UPLOADER_FLAGS += -P /dev/ttyUSB0
|
||||
# UPLOADER_FLAGS += -C <path-to-arduino-folder>/hardware/tools/avrdude.conf
|
||||
endif
|
||||
|
||||
|
||||
##############################################################################
|
||||
# #
|
||||
# Below here, defaults should be ok. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
PROGRAM = teacup
|
||||
|
||||
# The thing we build by default, and also the thing we clean.
|
||||
TARGET = $(PROGRAM).hex
|
||||
|
||||
# Arduino IDE takes the "compile everything available"-approach, so we have
|
||||
# to keep this working and can take a shortcut:
|
||||
#SOURCES = $(wildcard *.c)
|
||||
# Until the generic ARM port is completed, we'd have to wrap all sources
|
||||
# in #ifdef __AVR__. To avoid this, build only a selection for now:
|
||||
SOURCES = mendel.c cpu.c serial.c
|
||||
|
||||
# Other target MCU specific adjustments:
|
||||
|
||||
# Startup definitions. Not target MCU specific.
|
||||
CFLAGS = -D__STARTUP_CLEAR_BSS -D__START=main
|
||||
ifeq ($(MCU), lpc1114)
|
||||
CFLAGS += -mthumb -mcpu=cortex-m0
|
||||
CFLAGS += -mtune=cortex-m0
|
||||
CFLAGS += -D__ARM_LPC1114__
|
||||
endif
|
||||
# Other options ...
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wstrict-prototypes
|
||||
CFLAGS += -Os
|
||||
CFLAGS += -flto
|
||||
CFLAGS += -ffunction-sections
|
||||
CFLAGS += -fdata-sections
|
||||
# Until we're done with basic porting ...
|
||||
CFLAGS += -D__ARMEL_NOTYET__
|
||||
|
||||
LDFLAGS = --specs=nano.specs
|
||||
LDFLAGS += --specs=nosys.specs
|
||||
ifeq ($(MCU), lpc1114)
|
||||
LDFLAGS += -T arm-lpc1114.ld
|
||||
endif
|
||||
LDFLAGS += -Wl,--as-needed
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
LIBS = -lm
|
||||
|
||||
-include Makefile-common
|
||||
|
||||
# Architecture specific targets
|
||||
|
||||
.PHONY: all program size
|
||||
|
||||
all: $(PROGRAM).hex $(BUILDDIR)/$(PROGRAM).lst $(BUILDDIR)/$(PROGRAM).sym size
|
||||
|
||||
program: $(PROGRAM).hex config.h
|
||||
$(UPLOADER) $(UPLOADER_FLAGS) -U flash:w:$(PROGRAM).hex
|
||||
|
||||
$(BUILDDIR)/teacup.elf: $(BUILDDIR)/startup.o
|
||||
|
||||
$(BUILDDIR)/startup.o: arm-startup_lpc11xx.s | $(BUILDDIR)
|
||||
@echo " CC $@"
|
||||
@$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
## Interpret TARGET section sizes wrt different ARM chips
|
||||
## Usage: $(call show_size,section-name,section-regex,Atmega168-size-in-k,Atmega328p-size-in-k,Atmega644p-size-in-k,Atmega1280-size-in-k)
|
||||
define show_size
|
||||
@$(OBJDUMP) -h $^ | \
|
||||
perl -MPOSIX -ne \
|
||||
'/.($2)\s+([0-9a-f]+)/ && do { $$a += eval "0x$$2" }; \
|
||||
END { printf " %-7s: %5d bytes %3d%% %3d%% %3d%% %3d%%\n", "$1", $$a, \
|
||||
ceil($$a * 100 / ($3 * 1024)), \
|
||||
ceil($$a * 100 / ($4 * 1024)), \
|
||||
ceil($$a * 100 / ($5 * 1024)), \
|
||||
ceil($$a * 100 / ($6 * 1024)) \
|
||||
}'
|
||||
endef
|
||||
|
||||
size: $(BUILDDIR)/$(PROGRAM).elf
|
||||
@echo " SIZES ARM... lpc1114 '328(P) '644(P) '1280"
|
||||
$(call show_size,FLASH,text,32,30,62,126)
|
||||
$(call show_size,RAM,data|bss,4,2,4,8)
|
||||
$(call show_size,EEPROM,eeprom,1,2,2,4)
|
||||
|
|
@ -151,7 +151,7 @@ LIBS = -lm
|
|||
|
||||
# Architecture specific targets
|
||||
|
||||
.PHONY: program size
|
||||
.PHONY: all program size
|
||||
|
||||
all: $(PROGRAM).hex $(BUILDDIR)/$(PROGRAM).lst $(BUILDDIR)/$(PROGRAM).sym size
|
||||
|
||||
|
|
|
|||
35
arduino.h
35
arduino.h
|
|
@ -8,7 +8,7 @@
|
|||
#ifndef _ARDUINO_H
|
||||
#define _ARDUINO_H
|
||||
|
||||
#ifndef SIMULATOR
|
||||
#ifdef __AVR__
|
||||
#include <avr/io.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -63,14 +63,30 @@
|
|||
/// check if pin is an output wrapper
|
||||
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
|
||||
|
||||
/**
|
||||
Only AVRs have a Harvard Architecture, which has distinct address spaces
|
||||
for RAM, Flash and EEPROM. All other supported targets have a single address
|
||||
space, so all the macros PROGMEM, PSTR() & co. are obsolete. Define them to
|
||||
do nothing.
|
||||
|
||||
For the AVR definitions, see /usr/lib/avr/include/avr/pgmspace.h on Linux.
|
||||
*/
|
||||
#ifndef __AVR__
|
||||
#define PROGMEM
|
||||
#define PGM_P const char *
|
||||
#define PSTR(s) ((const PROGMEM char *)(s))
|
||||
#define pgm_read_byte(x) (*((uint8_t *)(x)))
|
||||
#define pgm_read_word(x) (*((uint16_t *)(x)))
|
||||
#define pgm_read_dword(x) (*((uint32_t *)(x)))
|
||||
#endif /* ! __AVR__ */
|
||||
|
||||
/*
|
||||
ports and functions
|
||||
|
||||
added as necessary or if I feel like it- not a comprehensive list!
|
||||
*/
|
||||
#ifdef SIMULATOR
|
||||
#include "simulator.h"
|
||||
#else
|
||||
#if defined __AVR__
|
||||
|
||||
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || \
|
||||
defined (__AVR_ATmega328P__)
|
||||
#include "arduino_168_328p.h"
|
||||
|
|
@ -97,7 +113,16 @@
|
|||
#if defined (__AVR_ATmega32U4__)
|
||||
#include "arduino_32U4.h"
|
||||
#endif
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
#elif defined __ARMEL__
|
||||
|
||||
#define DIO0_PIN remove when actually defined.
|
||||
|
||||
#elif defined SIMULATOR
|
||||
|
||||
#include "simulator.h"
|
||||
|
||||
#endif /* __AVR__, __ARMEL__, SIMULATOR */
|
||||
|
||||
#ifndef DIO0_PIN
|
||||
#error pins for this chip not defined in arduino.h! If you write an appropriate pin definition and have this firmware work on your chip, please tell us via the forum thread
|
||||
|
|
|
|||
|
|
@ -0,0 +1,158 @@
|
|||
/* Linker script for mbed LPC1114. */
|
||||
/*
|
||||
Changes for Teacup:
|
||||
|
||||
Copied from in spring 2015 from https://github.com/mbedmicro/mbed, file
|
||||
mbed/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/
|
||||
TOOLCHAIN_GCC_ARM/TARGET_LPC11XX/LPC1114.ld
|
||||
|
||||
- Removed trailing whitespace, replaced tabs by spaces.
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions. */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
|
||||
RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x0F40
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text.Reset_Handler)
|
||||
*(.text.SystemInit)
|
||||
. = 0x200;
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap :
|
||||
{
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy :
|
||||
{
|
||||
*(.stack)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
/* File: startup_ARMCM0.S
|
||||
* Purpose: startup file for Cortex-M0 devices. Should use with
|
||||
* GCC for ARM Embedded Processors
|
||||
* Version: V1.2
|
||||
* Date: 15 Nov 2011
|
||||
*
|
||||
* Copyright (c) 2011, ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* 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.
|
||||
* Neither the name of the ARM Limited 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 ARM LIMITED 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.
|
||||
*/
|
||||
/*
|
||||
Changes for Teacup:
|
||||
|
||||
Copied from in spring 2015 from https://github.com/mbedmicro/mbed, file
|
||||
mbed/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/
|
||||
TOOLCHAIN_GCC_ARM/startup_LPC11xx.s
|
||||
|
||||
- Removed trailing whitespace, replaced tabs by spaces.
|
||||
*/
|
||||
.syntax unified
|
||||
.arch armv6-m
|
||||
|
||||
/* Memory Model
|
||||
The HEAP starts at the end of the DATA section and grows upward.
|
||||
|
||||
The STACK starts at the end of the RAM and grows downward.
|
||||
|
||||
The HEAP and stack STACK are only checked at compile time:
|
||||
(DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
|
||||
|
||||
This is just a check for the bare minimum for the Heap+Stack area before
|
||||
aborting compilation, it is not the run time limit:
|
||||
Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
|
||||
*/
|
||||
.section .stack
|
||||
.align 3
|
||||
#ifdef __STACK_SIZE
|
||||
.equ Stack_Size, __STACK_SIZE
|
||||
#else
|
||||
.equ Stack_Size, 0x80
|
||||
#endif
|
||||
.globl __StackTop
|
||||
.globl __StackLimit
|
||||
__StackLimit:
|
||||
.space Stack_Size
|
||||
.size __StackLimit, . - __StackLimit
|
||||
__StackTop:
|
||||
.size __StackTop, . - __StackTop
|
||||
|
||||
.section .heap
|
||||
.align 3
|
||||
#ifdef __HEAP_SIZE
|
||||
.equ Heap_Size, __HEAP_SIZE
|
||||
#else
|
||||
.equ Heap_Size, 0x80
|
||||
#endif
|
||||
.globl __HeapBase
|
||||
.globl __HeapLimit
|
||||
__HeapBase:
|
||||
.space Heap_Size
|
||||
.size __HeapBase, . - __HeapBase
|
||||
__HeapLimit:
|
||||
.size __HeapLimit, . - __HeapLimit
|
||||
|
||||
.section .isr_vector
|
||||
.align 2
|
||||
.globl __isr_vector
|
||||
__isr_vector:
|
||||
.long __StackTop /* Top of Stack */
|
||||
.long Reset_Handler /* Reset Handler */
|
||||
.long NMI_Handler /* NMI Handler */
|
||||
.long HardFault_Handler /* Hard Fault Handler */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long SVC_Handler /* SVCall Handler */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long PendSV_Handler /* PendSV Handler */
|
||||
.long SysTick_Handler /* SysTick Handler */
|
||||
|
||||
/* LPC11xx interrupts */
|
||||
.long WAKEUP_IRQHandler /* 16 0 Wake-up on pin PIO0_0 */
|
||||
.long WAKEUP_IRQHandler /* 17 1 Wake-up on pin PIO0_1 */
|
||||
.long WAKEUP_IRQHandler /* 18 2 Wake-up on pin PIO0_2 */
|
||||
.long WAKEUP_IRQHandler /* 19 3 Wake-up on pin PIO0_3 */
|
||||
.long WAKEUP_IRQHandler /* 20 4 Wake-up on pin PIO0_4 */
|
||||
.long WAKEUP_IRQHandler /* 21 5 Wake-up on pin PIO0_5 */
|
||||
.long WAKEUP_IRQHandler /* 22 6 Wake-up on pin PIO0_6 */
|
||||
.long WAKEUP_IRQHandler /* 23 7 Wake-up on pin PIO0_7 */
|
||||
.long WAKEUP_IRQHandler /* 24 8 Wake-up on pin PIO0_8 */
|
||||
.long WAKEUP_IRQHandler /* 25 9 Wake-up on pin PIO0_9 */
|
||||
.long WAKEUP_IRQHandler /* 26 10 Wake-up on pin PIO0_10 */
|
||||
.long WAKEUP_IRQHandler /* 27 11 Wake-up on pin PIO0_11 */
|
||||
.long WAKEUP_IRQHandler /* 28 12 Wake-up on pin PIO1_0 */
|
||||
.long Default_Handler /* 29 13 */
|
||||
.long SSP1_IRQHandler /* 30 14 SSP1 */
|
||||
.long I2C_IRQHandler /* 31 15 I2C0 SI (state change) */
|
||||
.long TIMER16_0_IRQHandler /* 32 16 CT16B0 16 bit timer 0 */
|
||||
.long TIMER16_1_IRQHandler /* 33 17 CT16B1 16 bit timer 1 */
|
||||
.long TIMER32_0_IRQHandler /* 34 18 CT32B0 32 bit timer 0 */
|
||||
.long TIMER32_1_IRQHandler /* 35 19 CT32B1 32 bit timer 1 */
|
||||
.long SSP0_IRQHandler /* 36 20 SSP */
|
||||
.long UART_IRQHandler /* 37 21 UART */
|
||||
.long Default_Handler /* 38 22 */
|
||||
.long Default_Handler /* 39 23 */
|
||||
.long ADC_IRQHandler /* 40 24 ADC end of conversion */
|
||||
.long WDT_IRQHandler /* 41 25 Watchdog interrupt (WDINT) */
|
||||
.long BOD_IRQHandler /* 42 26 BOD Brown-out detect */
|
||||
.long Default_Handler /* 43 27 */
|
||||
.long PIOINT3_IRQHandler /* 44 28 PIO_3 GPIO interrupt status of port 3 */
|
||||
.long PIOINT2_IRQHandler /* 45 29 PIO_2 GPIO interrupt status of port 2 */
|
||||
.long PIOINT1_IRQHandler /* 46 30 PIO_1 GPIO interrupt status of port 1 */
|
||||
.long PIOINT0_IRQHandler /* 47 31 PIO_0 GPIO interrupt status of port 0 */
|
||||
|
||||
.size __isr_vector, . - __isr_vector
|
||||
|
||||
.section .text.Reset_Handler
|
||||
.thumb
|
||||
.thumb_func
|
||||
.align 2
|
||||
.globl Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
/* Loop to copy data from read only memory to RAM. The ranges
|
||||
* of copy from/to are specified by following symbols evaluated in
|
||||
* linker script.
|
||||
* __etext: End of code section, i.e., begin of data sections to copy from.
|
||||
* __data_start__/__data_end__: RAM address range that data should be
|
||||
* copied to. Both must be aligned to 4 bytes boundary. */
|
||||
|
||||
ldr r1, =__etext
|
||||
ldr r2, =__data_start__
|
||||
ldr r3, =__data_end__
|
||||
|
||||
subs r3, r2
|
||||
ble .Lflash_to_ram_loop_end
|
||||
|
||||
movs r4, 0
|
||||
.Lflash_to_ram_loop:
|
||||
ldr r0, [r1,r4]
|
||||
str r0, [r2,r4]
|
||||
adds r4, 4
|
||||
cmp r4, r3
|
||||
blt .Lflash_to_ram_loop
|
||||
.Lflash_to_ram_loop_end:
|
||||
|
||||
ldr r0, =SystemInit
|
||||
blx r0
|
||||
ldr r0, =_start
|
||||
bx r0
|
||||
.pool
|
||||
.size Reset_Handler, . - Reset_Handler
|
||||
|
||||
.text
|
||||
/* Macro to define default handlers. Default handler
|
||||
* will be weak symbol and just dead loops. They can be
|
||||
* overwritten by other handlers */
|
||||
.macro def_default_handler handler_name
|
||||
.align 1
|
||||
.thumb_func
|
||||
.weak \handler_name
|
||||
.type \handler_name, %function
|
||||
\handler_name :
|
||||
b .
|
||||
.size \handler_name, . - \handler_name
|
||||
.endm
|
||||
|
||||
def_default_handler NMI_Handler
|
||||
def_default_handler HardFault_Handler
|
||||
def_default_handler SVC_Handler
|
||||
def_default_handler PendSV_Handler
|
||||
def_default_handler SysTick_Handler
|
||||
def_default_handler Default_Handler
|
||||
|
||||
.macro def_irq_default_handler handler_name
|
||||
.weak \handler_name
|
||||
.set \handler_name, Default_Handler
|
||||
.endm
|
||||
|
||||
def_irq_default_handler WAKEUP_IRQHandler
|
||||
def_irq_default_handler SSP1_IRQHandler
|
||||
def_irq_default_handler I2C_IRQHandler
|
||||
def_irq_default_handler TIMER16_0_IRQHandler
|
||||
def_irq_default_handler TIMER16_1_IRQHandler
|
||||
def_irq_default_handler TIMER32_0_IRQHandler
|
||||
def_irq_default_handler TIMER32_1_IRQHandler
|
||||
def_irq_default_handler SSP0_IRQHandler
|
||||
def_irq_default_handler UART_IRQHandler
|
||||
def_irq_default_handler ADC_IRQHandler
|
||||
def_irq_default_handler WDT_IRQHandler
|
||||
def_irq_default_handler BOD_IRQHandler
|
||||
def_irq_default_handler PIOINT3_IRQHandler
|
||||
def_irq_default_handler PIOINT2_IRQHandler
|
||||
def_irq_default_handler PIOINT1_IRQHandler
|
||||
def_irq_default_handler PIOINT0_IRQHandler
|
||||
def_irq_default_handler DEF_IRQHandler
|
||||
|
||||
.end
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
/** \file
|
||||
\brief CPU initialisation, ARM specific part.
|
||||
|
||||
To be included from cpu.c, for details see there.
|
||||
*/
|
||||
|
||||
#if defined TEACUP_C_INCLUDE && defined __ARMEL__
|
||||
|
||||
/**
|
||||
SystemInit will be called before main from startup assembly code.
|
||||
*/
|
||||
void SystemInit(void) {
|
||||
}
|
||||
|
||||
#endif /* defined TEACUP_C_INCLUDE && defined __ARMEL__ */
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
/** \file
|
||||
\brief CPU initialisation, AVR specific part.
|
||||
|
||||
To be included from cpu.c, for details see there.
|
||||
*/
|
||||
|
||||
#if defined TEACUP_C_INCLUDE && defined __AVR__
|
||||
|
||||
/* Nothing yet. */
|
||||
|
||||
#endif /* defined TEACUP_C_INCLUDE && defined __AVR__ */
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
/** \file
|
||||
\brief CPU initialisation.
|
||||
|
||||
Functions to bring the CPU to a working state.
|
||||
*/
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
#define TEACUP_C_INCLUDE
|
||||
#include "cpu-avr.c"
|
||||
#include "cpu-arm.c"
|
||||
#undef TEACUP_C_INCLUDE
|
||||
|
||||
/* No common code so far. */
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
#ifndef _CPU_H
|
||||
#define _CPU_H
|
||||
|
||||
/* Nothing yet. */
|
||||
|
||||
#endif /* _CPU_H */
|
||||
14
mendel.c
14
mendel.c
|
|
@ -24,13 +24,16 @@
|
|||
ctrl+d \endcode
|
||||
*/
|
||||
|
||||
#ifndef SIMULATOR
|
||||
#ifdef __AVR__
|
||||
#include <avr/interrupt.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
#include "config_wrapper.h"
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
|
||||
#include "serial.h"
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
#include "dda_queue.h"
|
||||
#include "gcode_parse.h"
|
||||
#include "timer.h"
|
||||
|
|
@ -61,9 +64,11 @@
|
|||
#ifdef CANNED_CYCLE
|
||||
const char PROGMEM canned_gcode_P[] = CANNED_CYCLE;
|
||||
#endif
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
|
||||
/// initialise all I/O - set pins as input or output, turn off unused subsystems, etc
|
||||
void io_init(void) {
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
// disable modules we don't use
|
||||
#ifdef PRR
|
||||
#if defined TEMP_MAX6675 || defined SD
|
||||
|
|
@ -191,6 +196,7 @@ void io_init(void) {
|
|||
WRITE(DEBUG_LED_PIN, 0);
|
||||
SET_OUTPUT(DEBUG_LED_PIN);
|
||||
#endif
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
}
|
||||
|
||||
/** Initialise all the subsystems.
|
||||
|
|
@ -200,6 +206,7 @@ void io_init(void) {
|
|||
investigated).
|
||||
*/
|
||||
void init(void) {
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
// set up watchdog
|
||||
wd_init();
|
||||
|
||||
|
|
@ -244,6 +251,7 @@ void init(void) {
|
|||
|
||||
// prepare the power supply
|
||||
power_init();
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
|
||||
// say hi to host
|
||||
serial_writestr_P(PSTR("start\nok\n"));
|
||||
|
|
@ -261,13 +269,16 @@ int main (int argc, char** argv)
|
|||
int main (void)
|
||||
{
|
||||
#endif
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
uint8_t c, line_done, ack_waiting = 0;
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
|
||||
init();
|
||||
|
||||
// main loop
|
||||
for (;;)
|
||||
{
|
||||
#ifndef __ARMEL_NOTYET__
|
||||
// if queue is full, no point in reading chars- host will just have to wait
|
||||
if (queue_full() == 0) {
|
||||
/**
|
||||
|
|
@ -337,5 +348,6 @@ int main (void)
|
|||
}
|
||||
|
||||
clock();
|
||||
#endif /* __ARMEL_NOTYET__ */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
/** \file
|
||||
\brief Serial subsystem, ARM specific part.
|
||||
|
||||
To be included from serial.c, for details see there.
|
||||
*/
|
||||
|
||||
#if defined TEACUP_C_INCLUDE && defined __ARMEL__
|
||||
|
||||
#include "arduino.h"
|
||||
|
||||
|
||||
/** Initialise serial subsystem.
|
||||
|
||||
Set up baud generator and interrupts, clear buffers.
|
||||
*/
|
||||
void serial_init() {
|
||||
}
|
||||
|
||||
/** Check how many characters can be read.
|
||||
*/
|
||||
uint8_t serial_rxchars(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Read one character.
|
||||
*/
|
||||
uint8_t serial_popchar(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Send one character.
|
||||
*/
|
||||
void serial_writechar(uint8_t data) {
|
||||
}
|
||||
|
||||
#endif /* defined TEACUP_C_INCLUDE && defined __ARMEL__ */
|
||||
2
serial.c
2
serial.c
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#define TEACUP_C_INCLUDE
|
||||
#include "serial-avr.c"
|
||||
//#include "serial-arm.c"
|
||||
#include "serial-arm.c"
|
||||
#undef TEACUP_C_INCLUDE
|
||||
|
||||
|
||||
|
|
|
|||
2
serial.h
2
serial.h
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "config_wrapper.h"
|
||||
#include <stdint.h>
|
||||
#ifndef SIMULATOR
|
||||
#ifdef __AVR__
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
#include "simulator.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#ifndef SIMULATOR
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
#include "simulator.h"
|
||||
#include "arduino.h"
|
||||
|
||||
void sersendf(char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void sersendf_P(PGM_P format_P, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
|
|
|||
|
|
@ -54,13 +54,6 @@
|
|||
#include <stdbool.h>
|
||||
#include "simulator/data_recorder.h"
|
||||
|
||||
#define PROGMEM
|
||||
#define PGM_P const char *
|
||||
#define PSTR(x) (x)
|
||||
#define pgm_read_byte(x) (*((uint8_t *)(x)))
|
||||
#define pgm_read_word(x) (*((uint16_t *)(x)))
|
||||
#define pgm_read_dword(x) (*((uint32_t *)(x)))
|
||||
|
||||
#define MASK(PIN) (1 << PIN)
|
||||
#define ACD 7
|
||||
#define OCIE1A 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue