diff --git a/configs/freedom-k64f/include/board.h b/configs/freedom-k64f/include/board.h index 61ef7384cfe..4ce03acd932 100644 --- a/configs/freedom-k64f/include/board.h +++ b/configs/freedom-k64f/include/board.h @@ -1,8 +1,7 @@ /************************************************************************************ * configs/freedom-k64f/include/board.h - * include/arch/board/board.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -34,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_BOARD_BOARD_H -#define __ARCH_BOARD_BOARD_H +#ifndef __CONFIG_FREEDOM_K64F_INCLUDE_BOARD_H +#define __CONFIG_FREEDOM_K64F_INCLUDE_BOARD_H /************************************************************************************ * Included Files @@ -378,7 +377,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -386,6 +386,7 @@ extern "C" { /************************************************************************************ * Public Function Prototypes ************************************************************************************/ + /************************************************************************************ * Name: kinetis_boardinitialize * @@ -396,7 +397,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void kinetis_boardinitialize(void); +void kinetis_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) @@ -404,4 +405,4 @@ EXTERN void kinetis_boardinitialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_BOARD_BOARD_H */ +#endif /* __CONFIG_FREEDOM_K64F_INCLUDE_BOARD_H */ diff --git a/configs/freedom-k64f/nsh/setenv.sh b/configs/freedom-k64f/nsh/setenv.sh index cfb4e25e25c..43bab49e0ad 100644 --- a/configs/freedom-k64f/nsh/setenv.sh +++ b/configs/freedom-k64f/nsh/setenv.sh @@ -47,10 +47,25 @@ if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}" fi +# This is the Cygwin path to the location where I installed the Atmel GCC +# toolchain under Windows. You will also have to edit this if you install +# this toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin" + # This is the Cygwin path to the location where I installed the CodeSourcery # toolchain under windows. You will also have to edit this if you install # the CodeSourcery toolchain in any other location #export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin" +# export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin" + +# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors" +# You can this free toolchain here https://launchpad.net/gcc-arm-embedded +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin" + +# This is the path to the location where I installed the devkitARM toolchain +# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/ +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/bin" # This is the Cygwin path to the location where I build the buildroot # toolchain. @@ -58,4 +73,5 @@ export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin" # Add the path to the toolchain to the PATH varialble export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" + echo "PATH : ${PATH}" diff --git a/configs/freedom-k64f/src/Makefile b/configs/freedom-k64f/src/Makefile index 1b6b3167d38..05f58900fb0 100644 --- a/configs/freedom-k64f/src/Makefile +++ b/configs/freedom-k64f/src/Makefile @@ -1,7 +1,7 @@ ############################################################################ # configs/freedom-k64f/src/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without diff --git a/configs/freedom-k64f/src/freedom-k64f.h b/configs/freedom-k64f/src/freedom-k64f.h index 36320a34c30..0f90392bca7 100644 --- a/configs/freedom-k64f/src/freedom-k64f.h +++ b/configs/freedom-k64f/src/freedom-k64f.h @@ -1,7 +1,7 @@ /************************************************************************************ - * configs/twr-k60n512/src/twr-k60n512.h + * configs/freedom-k64f/src/freedom-k64f.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __CONFIGS_FREEDOM_K64F_SRC_FRDMK64_H -#define __CONFIGS_FREEDOM_K64F_SRC_FRDMK64_H +#ifndef __CONFIGS_FREEDOM_K64F_SRC_FREEDOM_K64F_H +#define __CONFIGS_FREEDOM_K64F_SRC_FREEDOM_K64F_H /************************************************************************************ * Included Files @@ -55,10 +55,10 @@ */ #if KINETIS_NSPI < 1 -# undef CONFIG_K64_SPI1 -# undef CONFIG_K64_SPI2 +# undef CONFIG_KINETIS_SPI1 +# undef CONFIG_KINETIS_SPI2 #elif KINETIS_NSPI < 2 -# undef CONFIG_K64_SPI2 +# undef CONFIG_KINETIS_SPI2 #endif /* FREEDOM-K64F GPIOs ****************************************************************/ @@ -293,4 +293,4 @@ void weak_function k64_spidev_initialize(void); void weak_function k64_usbinitialize(void); #endif /* __ASSEMBLY__ */ -#endif /* __CONFIGS_FREEDOM_K64F_SRC_FRDMK64_H */ +#endif /* __CONFIGS_FREEDOM_K64F_SRC_FREEDOM_K64F_H */ diff --git a/configs/freedom-k64f/src/k64_appinit.c b/configs/freedom-k64f/src/k64_appinit.c index 034f9e3b7c2..d55c3bfd064 100644 --- a/configs/freedom-k64f/src/k64_appinit.c +++ b/configs/freedom-k64f/src/k64_appinit.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/freedom-k64f/src/k64_appinit.c * - * Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ #include -#ifdef CONFIG_K64_SDHC +#ifdef CONFIG_KINETIS_SDHC # include # include #endif @@ -88,7 +88,7 @@ * is not enabled. */ -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_K64_SDHC) +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC) # undef NSH_HAVEMMCSD #endif @@ -102,8 +102,8 @@ # error "CONFIG_GPIO_IRQ required for card detect interrupt" #endif -#ifndef CONFIG_K64_PORTEINTS -# error "CONFIG_K64_PORTEINTS required for card detect interrupt" +#ifndef CONFIG_KINETIS_PORTEINTS +# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" #endif /**************************************************************************** @@ -224,7 +224,7 @@ int board_app_initialize(uintptr_t arg) /* Attached the card detect interrupt (but don't enable it yet) */ kinetis_pinconfig(GPIO_SD_CARDDETECT); - k64_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, k64_cdinterrupt); /* Configure the write protect GPIO */ @@ -264,7 +264,7 @@ int board_app_initialize(uintptr_t arg) /* Enable CD interrupts to handle subsequent media changes */ - k64_pinirqenable(GPIO_SD_CARDDETECT); + kinetis_pinirqenable(GPIO_SD_CARDDETECT); #endif return OK; } diff --git a/configs/freedom-k64f/src/k64_boot.c b/configs/freedom-k64f/src/k64_boot.c index 2eef462690d..1358f6633ad 100644 --- a/configs/freedom-k64f/src/k64_boot.c +++ b/configs/freedom-k64f/src/k64_boot.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/freedom-k64f/src/k64_boot.c * - * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,14 +47,6 @@ #include "up_arch.h" #include "freedom-k64f.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/************************************************************************************ - * Private Functions - ************************************************************************************/ - /************************************************************************************ * Public Functions ************************************************************************************/ @@ -71,32 +63,32 @@ void kinetis_boardinitialize(void) { +#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2) /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function * k64_spidev_initialize() has been brought into the link. */ -#if defined(CONFIG_K64_SPI1) || defined(CONFIG_K64_SPI2) if (k64_spidev_initialize) { k64_spidev_initialize(); } #endif +#if defined(CONFIG_USBDEV) && defined(CONFIG_KINETIS_USB) /* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not * disabled, and 3) the weak function k64_usbinitialize() has been brought * into the build. */ -#if defined(CONFIG_USBDEV) && defined(CONFIG_K64_USB) if (k64_usbinitialize) { k64_usbinitialize(); } #endif +#ifdef CONFIG_ARCH_LEDS /* Configure on-board LEDs if LED support has been selected. */ -#ifdef CONFIG_ARCH_LEDS board_autoled_initialize(); #endif } diff --git a/configs/freedom-k64f/src/k64_buttons.c b/configs/freedom-k64f/src/k64_buttons.c index c05c82b76c3..a8d5c3dcce2 100644 --- a/configs/freedom-k64f/src/k64_buttons.c +++ b/configs/freedom-k64f/src/k64_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/freedom-k64f/src/k64_buttons.c * - * Copyright (C) 2011, 2014-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -52,20 +52,13 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* The TWR-K60N512 has user buttons (plus a reset button): * * 1. SW1 (IRQ0) PTA19 * 2. SW2 (IRQ1) PTE26 */ -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -74,10 +67,10 @@ * Name: board_button_initialize * * Description: - * board_button_initialize() must be called to initialize button resources. After - * that, board_buttons() may be called to collect the current state of all - * buttons or board_button_irq() may be called to register button interrupt - * handlers. + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. * ****************************************************************************/ @@ -110,28 +103,29 @@ uint8_t board_buttons(void) return ret } -/************************************************************************************ +/**************************************************************************** * Button support. * * Description: - * board_button_initialize() must be called to initialize button resources. After - * that, board_buttons() may be called to collect the current state of all - * buttons or board_button_irq() may be called to register button interrupt - * handlers. + * board_button_initialize() must be called to initialize button + * resources. After that, board_buttons() may be called to collect the + * current state of all buttons or board_button_irq() may be called to + * register button interrupt handlers. * - * After board_button_initialize() has been called, board_buttons() may be called to - * collect the state of all buttons. board_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. + * After board_button_initialize() has been called, board_buttons() may + * be called to collect the state of all buttons. board_buttons() returns + * an 8-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning + * of each bit. * - * board_button_irq() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). + * board_button_irq() may be called to register an interrupt handler that + * will be called when a button is depressed or released. The ID value is + * a button enumeration value that uniquely identifies a button resource. + * See the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning + * of enumeration value. The previous interrupt handler address is + * returned (so that it may restored, if so desired). * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t board_button_irq(int id, xcpt_t irqhandler) @@ -164,7 +158,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler) /* Then make sure that interrupts are enabled on the pin */ - k64_pindmaenable(pinset); + kinetis_pindmaenable(pinset); return oldhandler; } #endif diff --git a/configs/freedom-k64f/src/k64_leds.c b/configs/freedom-k64f/src/k64_leds.c index 65488f1ccf0..da05edc8484 100644 --- a/configs/freedom-k64f/src/k64_leds.c +++ b/configs/freedom-k64f/src/k64_leds.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/freedom-k64f/src/k64_leds.c * - * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,6 +49,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* The FREEDOM-K64F has four LEDs: * * 1. E1 / Orange LED PTA11 diff --git a/configs/freedom-k64f/src/k64_spi.c b/configs/freedom-k64f/src/k64_spi.c index b6c5ea32f8f..847d5af7e47 100644 --- a/configs/freedom-k64f/src/k64_spi.c +++ b/configs/freedom-k64f/src/k64_spi.c @@ -1,7 +1,7 @@ /************************************************************************************ - * configs/freedom-k64f/src/k60_spi.c + * configs/freedom-k64f/src/k64_spi.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -51,7 +51,7 @@ #include "kinetis.h" #include "freedom-k64f.h" -#if defined(CONFIG_K64_SPI1) || defined(CONFIG_K64_SPI2) +#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2) /************************************************************************************ * Public Functions @@ -77,8 +77,8 @@ void weak_function k64_spidev_initialize(void) * These external functions must be provided by board-specific logic. They are * implementations of the select, status, and cmddata methods of the SPI interface * defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods - * including kinetis_spibus_initialize()) are provided by common Kinetis logic. To use - * this common SPI logic on your board: + * including kinetis_spibus_initialize()) are provided by common Kinetis logic. + * To use this common SPI logic on your board: * * 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select * pins. @@ -98,7 +98,7 @@ void weak_function k64_spidev_initialize(void) * ************************************************************************************/ -#ifdef CONFIG_K64_SPI1 +#ifdef CONFIG_KINETIS_SPI1 void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); @@ -112,7 +112,7 @@ uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) } #endif -#ifdef CONFIG_K64_SPI2 +#ifdef CONFIG_KINETIS_SPI2 void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); @@ -126,7 +126,7 @@ uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) } #endif -#ifdef CONFIG_K64_SPI3 +#ifdef CONFIG_KINETIS_SPI3 void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); @@ -140,4 +140,4 @@ uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) } #endif -#endif /* CONFIG_K64_SPI1 || CONFIG_K64_SPI2 */ +#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */ diff --git a/configs/freedom-k64f/src/k64_usbdev.c b/configs/freedom-k64f/src/k64_usbdev.c index 144aabae49b..379f0e2cc19 100644 --- a/configs/freedom-k64f/src/k64_usbdev.c +++ b/configs/freedom-k64f/src/k64_usbdev.c @@ -1,7 +1,7 @@ /************************************************************************************ - * configs/freedom-k64f/src/k60_usbdev.c + * configs/freedom-k64f/src/k64_usbdev.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -51,14 +51,6 @@ #include "kinetis.h" #include "freedom-k64f.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/************************************************************************************ - * Private Functions - ************************************************************************************/ - /************************************************************************************ * Public Functions ************************************************************************************/ @@ -77,18 +69,18 @@ void k64_usbinitialize(void) } /************************************************************************************ - * Name: k64_usbpullup + * Name: kinetis_usbpullup * * Description: * If USB is supported and the board supports a pullup via GPIO (for USB software - * connect and disconnect), then the board software must provide k64_pullup. + * connect and disconnect), then the board software must provide kinetis_usbpullup. * See include/nuttx/usb/usbdev.h for additional description of this method. * Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be * NULL. * ************************************************************************************/ -int k64_usbpullup(FAR struct usbdev_s *dev, bool enable) +int kinetis_usbpullup(FAR struct usbdev_s *dev, bool enable) { usbtrace(TRACE_DEVPULLUP, (uint16_t)enable); # warning "Missing logic" @@ -96,18 +88,18 @@ int k64_usbpullup(FAR struct usbdev_s *dev, bool enable) } /************************************************************************************ - * Name: k64_usbsuspend + * Name: kinetis_usbsuspend * * Description: - * Board logic must provide the k64_usbsuspend logic if the USBDEV driver is + * Board logic must provide the kinetis_usbsuspend logic if the USBDEV driver is * used. This function is called whenever the USB enters or leaves suspend mode. * This is an opportunity for the board logic to shutdown clocks, power, etc. * while the USB is suspended. * ************************************************************************************/ -void k64_usbsuspend(FAR struct usbdev_s *dev, bool resume) +void kinetis_usbsuspend(FAR struct usbdev_s *dev, bool resume) { - ullinfo("resume: %d\n", resume); + uinfo("resume: %d\n", resume); #warning "Missing logic" } diff --git a/configs/freedom-k64f/src/k64_usbmsc.c b/configs/freedom-k64f/src/k64_usbmsc.c index bef62c1ae7a..06ff717d637 100644 --- a/configs/freedom-k64f/src/k64_usbmsc.c +++ b/configs/freedom-k64f/src/k64_usbmsc.c @@ -1,7 +1,7 @@ /**************************************************************************** - * configs/freedom-k64f/src/k60_usbmsc.c + * configs/freedom-k64f/src/k64_usbmsc.c * - * Copyright (C) 2011, 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Configure and register the Kinetis MMC/SD block driver.