From 97a15799b4f8d464e006f1c25546798cd4f385f6 Mon Sep 17 00:00:00 2001 From: Kelvin Lawson Date: Thu, 21 Jun 2012 21:29:18 +0100 Subject: [PATCH] AVR port: instructions for using PART= to change the CPU target during make. Also add TESTS_LOG_STACK parameter so that stack-usage logging can be enabled without editing Makefile. --- ports/avr/Makefile | 8 +++++++- ports/avr/README | 23 ++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ports/avr/Makefile b/ports/avr/Makefile index 7fdb5c4..17d7d74 100644 --- a/ports/avr/Makefile +++ b/ports/avr/Makefile @@ -28,6 +28,9 @@ PART=atmega16 # must disable stack-checking to run all of the automated tests. #STACK_CHECK=true +# Test programs: Log stack usage to UART (if STACK_CHECK is enabled) +#TESTS_LOG_STACK=true + # Directory for built objects BUILD_DIR=build @@ -57,10 +60,13 @@ vpath %.hex ./$(BUILD_DIR) # GCC flags CFLAGS=-g -mmcu=$(PART) -Wall -Werror -# Enable stack-checking (disable if not required) +# Enable stack-checking options (disable if not required) ifeq ($(STACK_CHECK),true) CFLAGS += -DATOM_STACK_CHECKING endif +ifeq ($(TESTS_LOG_STACK),true) +CFLAGS += -DTESTS_LOG_STACK_USAGE +endif ################# diff --git a/ports/avr/README b/ports/avr/README index e73fa4c..37413e3 100644 --- a/ports/avr/README +++ b/ports/avr/README @@ -66,9 +66,10 @@ can easily replace UISP by your own favourite programmer if required. BUILDING THE SOURCE A Makefile is provided for building the kernel, port and automated tests. -The full build is carried out using simply: +The full build is carried out using the following (replacing PART by the +ATmega device you are using): - * make + * make PART=atmega128 All objects are built into the 'build' folder under ports/avr. The build process builds separate target applications for each automated test, and @@ -96,11 +97,12 @@ PROGRAMMING TO THE TARGET DEVICE Application HEX files which are built into the build folder can be downloaded to the target using: - * make program app= + * make PART= program app= -For example to download the 'sem1.hex' test application to the target use: +For example to download the 'sem1.hex' test application to an ATmega128 +target use: - * make program app=sem1 + * make PART=atmega128 program app=sem1 This uses UISP which will write the application into flash and reset the CPU to start running the program automatically. @@ -143,11 +145,11 @@ The full set of tests can be found in the top-level 'tests' folder. Each of these tests is built as an independent application in the 'build' folder. Run them individually using: - * make program app=testname + * make PART= program app= -For example to run the 'kern1.c' test use: +For example to run the 'kern1.c' test on an ATmega128 device use: - * make program app=kern1 + * make PART=atmega128 program app=kern1 Before running the program and data size for the application is printed out on the terminal. You can use this to verify that your platform has @@ -204,7 +206,10 @@ a call to your own application startup code. PORTING TO OTHER HARDWARE PLATFORMS If you are using a CPU other than the ATmega16, change the PART definition -in the Makefile to your own CPU. +in the Makefile to your own CPU, or specify the PART on the make command +line using: + + * make PART=atmega128 On CPUs with multiple UARTs, the port uses UART0 to output debug information. If you wish to use an alternative UART you may change the