New HAL and SimpleMAC for STM32W108.
This commit is contained in:
parent
c9af578eab
commit
eb588f1aec
|
@ -45,9 +45,9 @@ ifdef IAR
|
||||||
TARGET_LIBFILES = $(CONTIKI_CPU)/simplemac/library/simplemac-library.a
|
TARGET_LIBFILES = $(CONTIKI_CPU)/simplemac/library/simplemac-library.a
|
||||||
else
|
else
|
||||||
ifdef PRINTF_FLOAT
|
ifdef PRINTF_FLOAT
|
||||||
TARGET_LIBFILES = $(CONTIKI_CPU)/simplemac/library/simplemac-library.a $(CONTIKI_CPU)/hal/micro/cortexm3/e_stdio_thumb2.a
|
TARGET_LIBFILES = $(CONTIKI_CPU)/simplemac/library/simplemac-library-gnu.a $(CONTIKI_CPU)/hal/micro/cortexm3/e_stdio_thumb2.a
|
||||||
else
|
else
|
||||||
TARGET_LIBFILES = $(CONTIKI_CPU)/simplemac/library/simplemac-library.a $(CONTIKI_CPU)/hal/micro/cortexm3/e_stdio_intonly_thumb2.a
|
TARGET_LIBFILES = $(CONTIKI_CPU)/simplemac/library/simplemac-library-gnu.a $(CONTIKI_CPU)/lib/e_stdio_intonly_thumb2.a
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
# `$(CC) -print-file-name=thumb2/libc.a` `$(CC) -print-file-name=thumb2/libgcc.a`
|
# `$(CC) -print-file-name=thumb2/libc.a` `$(CC) -print-file-name=thumb2/libgcc.a`
|
||||||
|
@ -74,7 +74,7 @@ AROPTS = --create
|
||||||
ASFLAGS = -s+ -w+ --cpu Cortex-M3 -L$(OBJECTDIR)
|
ASFLAGS = -s+ -w+ --cpu Cortex-M3 -L$(OBJECTDIR)
|
||||||
LDFLAGS += --redirect _Printf=_PrintfSmall --redirect _Scanf=_ScanfSmall --map=contiki-$(TARGET).map
|
LDFLAGS += --redirect _Printf=_PrintfSmall --redirect _Scanf=_ScanfSmall --map=contiki-$(TARGET).map
|
||||||
ifndef COFFEE
|
ifndef COFFEE
|
||||||
LDFLAGS+= --config $(CONTIKI_CPU)/hal/micro/cortexm3/stm32w108/iar-cfg.icf
|
LDFLAGS+= --config $(CONTIKI_CPU)/iar-cfg.icf
|
||||||
endif
|
endif
|
||||||
OBJOPTS = --bin
|
OBJOPTS = --bin
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ ASFLAGS = -mthumb -mcpu=cortex-m3 -fsigned-char -c -g -Wall -Os -ffunction-secti
|
||||||
-mlittle-endian -fshort-enums -x assembler-with-cpp -Wa,-EL
|
-mlittle-endian -fshort-enums -x assembler-with-cpp -Wa,-EL
|
||||||
LDFLAGS += -mcpu=cortex-m3 \
|
LDFLAGS += -mcpu=cortex-m3 \
|
||||||
-mthumb \
|
-mthumb \
|
||||||
-Wl,-T -Xlinker $(CONTIKI_CPU)/hal/micro/cortexm3/stm32w108/gnu.ld \
|
-Wl,-T -Xlinker $(CONTIKI_CPU)/gnu.ld \
|
||||||
-Wl,-static \
|
-Wl,-static \
|
||||||
-u Default_Handler \
|
-u Default_Handler \
|
||||||
-nostartfiles \
|
-nostartfiles \
|
||||||
|
@ -118,8 +118,6 @@ OBJOPTS = -O binary
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifndef IAR
|
|
||||||
|
|
||||||
ifdef COFFEE_ADDRESS
|
ifdef COFFEE_ADDRESS
|
||||||
COFFEE = 1
|
COFFEE = 1
|
||||||
endif
|
endif
|
||||||
|
@ -147,15 +145,18 @@ ifeq ($(COFFEE),1)
|
||||||
|
|
||||||
else
|
else
|
||||||
# Coffee starts at the end of the flash, before NVM section.
|
# Coffee starts at the end of the flash, before NVM section.
|
||||||
COFFEE_ADDRESS = 0x801F400
|
COFFEE_ADDRESS = 0x801F800
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifndef IAR
|
||||||
|
|
||||||
LDFLAGS+= -Wl,--section-start=.coffee=$(COFFEE_ADDRESS)
|
LDFLAGS+= -Wl,--section-start=.coffee=$(COFFEE_ADDRESS)
|
||||||
|
|
||||||
else #IAR
|
else #IAR
|
||||||
|
|
||||||
ifeq ($(COFFEE),1)
|
ifeq ($(COFFEE),1)
|
||||||
LDFLAGS+= --config $(CONTIKI_CPU)/hal/micro/cortexm3/stm32w108/iar-cfg-coffee.icf
|
LDFLAGS+= --config $(CONTIKI_CPU)/iar-cfg-coffee.icf
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
/* If using IAR, COFFEE_ADDRESS reflects the static value in the linker script
|
/* If using IAR, COFFEE_ADDRESS reflects the static value in the linker script
|
||||||
iar-cfg-coffee.icf, so it can't be passed as a parameter for Make.*/
|
iar-cfg-coffee.icf, so it can't be passed as a parameter for Make.*/
|
||||||
#ifdef __ICCARM__
|
#ifdef __ICCARM__
|
||||||
#define COFFEE_ADDRESS 0x8010000
|
#define COFFEE_ADDRESS 0x8010c00
|
||||||
#endif
|
#endif
|
||||||
#if (COFFEE_ADDRESS & 0x3FF) !=0
|
#if (COFFEE_ADDRESS & 0x3FF) !=0
|
||||||
#error "COFFEE_ADDRESS not aligned to a 1024-bytes page boundary."
|
#error "COFFEE_ADDRESS not aligned to a 1024-bytes page boundary."
|
||||||
|
@ -96,9 +96,10 @@
|
||||||
#define COFFEE_LOG_SIZE 128 // COFFEE_MICRO_LOGS is 0.
|
#define COFFEE_LOG_SIZE 128 // COFFEE_MICRO_LOGS is 0.
|
||||||
|
|
||||||
|
|
||||||
#if COFFEE_PAGES <= 0x100
|
#if COFFEE_PAGES <= 127
|
||||||
#define coffee_page_t uint8_t
|
#define coffee_page_t int8_t
|
||||||
#elif COFFEE_PAGES <= 0x10000
|
#elif COFFEE_PAGES <= 0x7FFF
|
||||||
|
#define coffee_page_t int16_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||||
* File Name : stm32f10x_conf.h
|
* File Name : stm32w_conf.h
|
||||||
* Author : MCD Application Team
|
* Author : MCD Application Team
|
||||||
* Version : V2.0.3
|
* Version : V2.0.3
|
||||||
* Date : 09/22/2008
|
* Date : 09/22/2008
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
#define __STM32F10x_CONF_H
|
#define __STM32F10x_CONF_H
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32w_type.h"
|
#include "stm32w108_type.h"
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
||||||
* File Name : stm32f10x_systick.c
|
* File Name : stm32w108_systick.c
|
||||||
* Author : MCD Application Team
|
* Author : MCD Application Team
|
||||||
* Version : V2.0.3
|
* Version : V2.0.3
|
||||||
* Date : 09/22/2008
|
* Date : 09/22/2008
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#ifndef __STM32W_SYSTICK_H
|
#ifndef __STM32W_SYSTICK_H
|
||||||
#define __STM32W_SYSTICK_H
|
#define __STM32W_SYSTICK_H
|
||||||
|
|
||||||
#include "stm32w_type.h"
|
#include "stm32w108_type.h"
|
||||||
#include "stm32w_conf.h"
|
#include "stm32w_conf.h"
|
||||||
|
|
||||||
#ifndef EXT
|
#ifndef EXT
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
|
|
||||||
* File Name : stm32f10x_type.h
|
|
||||||
* Author : MCD Application Team
|
|
||||||
* Version : V2.0.3
|
|
||||||
* Date : 09/22/2008
|
|
||||||
* Description : This file contains all the common data types used for the
|
|
||||||
* STM32F10x firmware library.
|
|
||||||
********************************************************************************
|
|
||||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
|
||||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
|
||||||
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
|
||||||
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
|
||||||
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
|
||||||
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __STM32F10x_TYPE_H
|
|
||||||
#define __STM32F10x_TYPE_H
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
typedef signed long s32;
|
|
||||||
typedef signed short s16;
|
|
||||||
typedef signed char s8;
|
|
||||||
|
|
||||||
typedef signed long const sc32; /* Read Only */
|
|
||||||
typedef signed short const sc16; /* Read Only */
|
|
||||||
typedef signed char const sc8; /* Read Only */
|
|
||||||
|
|
||||||
typedef volatile signed long vs32;
|
|
||||||
typedef volatile signed short vs16;
|
|
||||||
typedef volatile signed char vs8;
|
|
||||||
|
|
||||||
typedef volatile signed long const vsc32; /* Read Only */
|
|
||||||
typedef volatile signed short const vsc16; /* Read Only */
|
|
||||||
typedef volatile signed char const vsc8; /* Read Only */
|
|
||||||
|
|
||||||
typedef unsigned long u32;
|
|
||||||
typedef unsigned short u16;
|
|
||||||
typedef unsigned char u8;
|
|
||||||
|
|
||||||
typedef unsigned long const uc32; /* Read Only */
|
|
||||||
typedef unsigned short const uc16; /* Read Only */
|
|
||||||
typedef unsigned char const uc8; /* Read Only */
|
|
||||||
|
|
||||||
typedef volatile unsigned long vu32;
|
|
||||||
typedef volatile unsigned short vu16;
|
|
||||||
typedef volatile unsigned char vu8;
|
|
||||||
|
|
||||||
typedef volatile unsigned long const vuc32; /* Read Only */
|
|
||||||
typedef volatile unsigned short const vuc16; /* Read Only */
|
|
||||||
typedef volatile unsigned char const vuc8; /* Read Only */
|
|
||||||
|
|
||||||
//typedef enum {FALSE = 0, TRUE = !FALSE} bool;
|
|
||||||
|
|
||||||
typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
|
|
||||||
|
|
||||||
typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
|
|
||||||
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
|
||||||
|
|
||||||
typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
|
|
||||||
|
|
||||||
#define U8_MAX ((u8)255)
|
|
||||||
#define S8_MAX ((s8)127)
|
|
||||||
#define S8_MIN ((s8)-128)
|
|
||||||
#define U16_MAX ((u16)65535u)
|
|
||||||
#define S16_MAX ((s16)32767)
|
|
||||||
#define S16_MIN ((s16)-32768)
|
|
||||||
#define U32_MAX ((u32)4294967295uL)
|
|
||||||
#define S32_MAX ((s32)2147483647)
|
|
||||||
#define S32_MIN ((s32)-2147483648)
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/* Exported functions ------------------------------------------------------- */
|
|
||||||
|
|
||||||
#endif /* __STM32F10x_TYPE_H */
|
|
||||||
|
|
||||||
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
|
|
53
cpu/stm32w108/dev/uart1.h.bak
Normal file
53
cpu/stm32w108/dev/uart1.h.bak
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Swedish Institute of Computer Science.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||||
|
*
|
||||||
|
* This file is part of the Contiki operating system.
|
||||||
|
*
|
||||||
|
* $Id: uart1.h,v 1.1 2010/10/25 09:03:39 salvopitru Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* A brief description of what this file is.
|
||||||
|
* \author
|
||||||
|
* Adam Dunkels <adam@sics.se>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __UART1_H__
|
||||||
|
#define __UART1_H__
|
||||||
|
|
||||||
|
//#include "msp430.h"
|
||||||
|
//
|
||||||
|
//#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
||||||
|
|
||||||
|
void uart1_set_input(int (*input)(unsigned char c));
|
||||||
|
void uart1_writeb(unsigned char c);
|
||||||
|
void uart1_init(unsigned long ubr);
|
||||||
|
//uint8_t uart1_active(void);
|
||||||
|
|
||||||
|
#endif /* __UART1_H__ */
|
236
cpu/stm32w108/gnu.ld
Normal file
236
cpu/stm32w108/gnu.ld
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
/*SEARCH_DIR("C:\Program Files\Raisonance\Ride\Lib\ARM")
|
||||||
|
EXTERN( __io_putchar )
|
||||||
|
EXTERN( _write )
|
||||||
|
GROUP(
|
||||||
|
"std_sbrk_thumb.lib"
|
||||||
|
"smallprintf_thumb.a"
|
||||||
|
"libc.a"
|
||||||
|
"libm.a"
|
||||||
|
)
|
||||||
|
*/
|
||||||
|
/* default stack sizes.
|
||||||
|
|
||||||
|
These are used by the startup in order to allocate stacks for the different modes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
__Stack_Size = 0x500 ;
|
||||||
|
|
||||||
|
PROVIDE ( _Stack_Size = __Stack_Size ) ;
|
||||||
|
|
||||||
|
__Stack_Init = 0x20000000;
|
||||||
|
|
||||||
|
_estack = __Stack_Init + __Stack_Size;
|
||||||
|
|
||||||
|
|
||||||
|
/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
|
||||||
|
PROVIDE ( _Stack_Init = __Stack_Init ) ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
this sends all unreferenced IRQHandlers to a Default_Handler or a reset.
|
||||||
|
*/
|
||||||
|
|
||||||
|
PROVIDE(Default_Handler = 0 );
|
||||||
|
PROVIDE(NMI_Handler = Default_Handler );
|
||||||
|
PROVIDE(HardFault_Handler = Default_Handler );
|
||||||
|
PROVIDE(MemManage_Handler = Default_Handler );
|
||||||
|
PROVIDE(BusFault_Handler = Default_Handler );
|
||||||
|
PROVIDE(UsageFault_Handler = Default_Handler );
|
||||||
|
PROVIDE(SVC_Handler = Default_Handler );
|
||||||
|
PROVIDE(DebugMonitor_Handler = Default_Handler );
|
||||||
|
PROVIDE(PendSV_Handler = Default_Handler );
|
||||||
|
PROVIDE(SysTick_Handler = Default_Handler );
|
||||||
|
PROVIDE(halTimer1Isr = Default_Handler );
|
||||||
|
PROVIDE(halTimer2Isr = Default_Handler );
|
||||||
|
PROVIDE(halManagementIsr = Default_Handler );
|
||||||
|
PROVIDE(halBaseBandIsr = Default_Handler );
|
||||||
|
PROVIDE(halSleepTimerIsr = Default_Handler );
|
||||||
|
PROVIDE(halSc1Isr = Default_Handler );
|
||||||
|
PROVIDE(halSc2Isr = Default_Handler );
|
||||||
|
PROVIDE(halSecurityIsr = Default_Handler );
|
||||||
|
PROVIDE(halStackMacTimerIsr = Default_Handler );
|
||||||
|
PROVIDE(stmRadioTransmitIsr = Default_Handler );
|
||||||
|
PROVIDE(stmRadioReceiveIsr = Default_Handler );
|
||||||
|
PROVIDE(halAdcIsr = Default_Handler );
|
||||||
|
PROVIDE(halIrqAIsr = Default_Handler );
|
||||||
|
PROVIDE(halIrqBIsr = Default_Handler );
|
||||||
|
PROVIDE(halIrqCIsr = Default_Handler );
|
||||||
|
PROVIDE(halIrqDIsr = Default_Handler );
|
||||||
|
PROVIDE(halDebugIsr = Default_Handler );
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Peripheral memory map */
|
||||||
|
/******************************************************************************/
|
||||||
|
/*this allows to compile the ST lib in "non-debug" mode*/
|
||||||
|
_BOOTLOADER_SIZE = 0x3000 ;
|
||||||
|
_ROM_base = DEFINED(ST_BTL) ? (0x08000000 + _BOOTLOADER_SIZE) : 0x08000000 ;
|
||||||
|
/* include the memory spaces definitions sub-script */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
RAM_region (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
|
||||||
|
ROM_region (rx) : ORIGIN = 0x08000000, LENGTH = 128K-2K
|
||||||
|
NVM_region (rx) : ORIGIN = 0x0801F800, LENGTH = 2K
|
||||||
|
FIB_region (ra) : ORIGIN = 0x08040000, LENGTH = 2K
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Sections management for FLASH mode */
|
||||||
|
|
||||||
|
/* Sections Definitions */
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
|
||||||
|
/* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
|
||||||
|
|
||||||
|
.isr_vector (DEFINED(ST_BTL) ? (0x08000000 + _BOOTLOADER_SIZE) : 0x08000000) :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
__ApplicationFlashStart = . ;
|
||||||
|
/* . = . + _ROM_base ;*/
|
||||||
|
KEEP(*(.isr_vector)) /* Startup code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >ROM_region
|
||||||
|
|
||||||
|
/* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
|
||||||
|
.flashtext :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.flashtext) /* Startup code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >ROM_region
|
||||||
|
|
||||||
|
/* the program code is stored in the .text section, which goes to Flash */
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
|
||||||
|
*(.text) /* remaining code */
|
||||||
|
*(.text.*) /* remaining code */
|
||||||
|
*(.rodata) /* read-only data (constants) */
|
||||||
|
*(.rodata*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
. = (DEFINED(ELF_LOADER) ? ALIGN(1024) : .);
|
||||||
|
*(.elf_text)
|
||||||
|
. = (DEFINED(ELF_LOADER) ? ALIGN(1024) : .);
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .;
|
||||||
|
/* This is used by the startup in order to initialize the .data section */
|
||||||
|
_sidata = _etext;
|
||||||
|
} >ROM_region
|
||||||
|
|
||||||
|
/* Section start can be overridden via command line. */
|
||||||
|
.coffee 0x08010c0 :
|
||||||
|
{
|
||||||
|
_coffee_start = ABSOLUTE(.);
|
||||||
|
. = ALIGN(1024);
|
||||||
|
*(.coffeefiles)
|
||||||
|
. = ORIGIN(NVM_region) - _coffee_start;
|
||||||
|
} > ROM_region = 0x00
|
||||||
|
|
||||||
|
|
||||||
|
NVM (NOLOAD):
|
||||||
|
{
|
||||||
|
. = ALIGN(1024);
|
||||||
|
KEEP(*(NVM))
|
||||||
|
. = ALIGN(4);
|
||||||
|
} > NVM_region
|
||||||
|
|
||||||
|
|
||||||
|
FAT (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(FAT))
|
||||||
|
. = ALIGN(4);
|
||||||
|
} > FIB_region
|
||||||
|
|
||||||
|
/* after that it's only debugging information. */
|
||||||
|
|
||||||
|
|
||||||
|
/* This is the initialized data section
|
||||||
|
The program executes knowing that the data is in the RAM
|
||||||
|
but the loader puts the initial values in the FLASH (inidata).
|
||||||
|
It is one task of the startup to copy the initial values from FLASH to RAM. */
|
||||||
|
.data _estack : AT ( _sidata )
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* This is used by the startup in order to initialize the .data section */
|
||||||
|
_sdata = . ;
|
||||||
|
|
||||||
|
*(.data)
|
||||||
|
*(.data.*)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* This is used by the startup in order to initialize the .data secion */
|
||||||
|
_edata = . ;
|
||||||
|
ASSERT(_sidata + SIZEOF(.data) < LOADADDR(.coffee), ".data section overflow in ROM");
|
||||||
|
} >RAM_region
|
||||||
|
|
||||||
|
|
||||||
|
/* This is the uninitialized data section */
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* This is used by the startup in order to initialize the .bss secion */
|
||||||
|
_sbss = .;
|
||||||
|
|
||||||
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
|
*(COMMON)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* This is used by the startup in order to initialize the .bss secion */
|
||||||
|
_ebss = . ;
|
||||||
|
} >RAM_region
|
||||||
|
|
||||||
|
PROVIDE ( end = _ebss );
|
||||||
|
PROVIDE ( _end = _ebss );
|
||||||
|
|
||||||
|
__exidx_start = .;
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
|
/* remove the debugging information from the standard libraries */
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
libc.a ( * )
|
||||||
|
libm.a ( * )
|
||||||
|
libgcc.a ( * )
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stabs debugging sections. */
|
||||||
|
.stab 0 : { *(.stab) }
|
||||||
|
.stabstr 0 : { *(.stabstr) }
|
||||||
|
.stab.excl 0 : { *(.stab.excl) }
|
||||||
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||||
|
.stab.index 0 : { *(.stab.index) }
|
||||||
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||||
|
.comment 0 : { *(.comment) }
|
||||||
|
/* DWARF debug sections.
|
||||||
|
Symbols in the DWARF debugging sections are relative to the beginning
|
||||||
|
of the section so we begin them at 0. */
|
||||||
|
/* DWARF 1 */
|
||||||
|
.debug 0 : { *(.debug) }
|
||||||
|
.line 0 : { *(.line) }
|
||||||
|
/* GNU DWARF 1 extensions */
|
||||||
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||||
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||||
|
/* DWARF 1.1 and DWARF 2 */
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
/* DWARF 2 */
|
||||||
|
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_frame 0 : { *(.debug_frame) }
|
||||||
|
.debug_str 0 : { *(.debug_str) }
|
||||||
|
.debug_loc 0 : { *(.debug_loc) }
|
||||||
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||||
|
/* SGI/MIPS DWARF 2 extensions */
|
||||||
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||||
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||||
|
.debug_typenames 0 : { *(.debug_typenames) }
|
||||||
|
.debug_varnames 0 : { *(.debug_varnames) }
|
||||||
|
}
|
||||||
|
|
||||||
|
__ApplicationFlashEnd = _sidata + (_edata - _sdata);
|
File diff suppressed because it is too large
Load diff
|
@ -1,18 +0,0 @@
|
||||||
<hr size="1">
|
|
||||||
<table border="0" cellspacing="0" cellpadding="0" width=100%>
|
|
||||||
<tr>
|
|
||||||
<td><address><small>
|
|
||||||
$projectname. <br>
|
|
||||||
$projectnumber.
|
|
||||||
</small></address>
|
|
||||||
</td>
|
|
||||||
<td align="right">
|
|
||||||
<address><small>
|
|
||||||
Copyright © 2009 by STMicrolectronics. All rights reserved.<br>
|
|
||||||
Generated $datetime with <a href="http://www.doxygen.org/index.html">Doxygen</a> $doxygenversion.
|
|
||||||
</small></address>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
||||||
<title>$title</title>
|
|
||||||
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
||||||
</head><body>
|
|
||||||
<table border="0" cellspacing="0" cellpadding="0" width=100%>
|
|
||||||
<tr>
|
|
||||||
<td><img src="ST_Logo.gif"></td>
|
|
||||||
<td> <div class="qindex">
|
|
||||||
<a class="qindex" href="index.html">Home</a>
|
|
||||||
| <a class="qindex" href="modules.html">Modules</a>
|
|
||||||
| <a class="qindex" href="annotated.html">Data Structures</a>
|
|
||||||
| <a class="qindex" href="files.html">File List</a>
|
|
||||||
| <a class="qindex" href="globals.html">Index</a></div>
|
|
||||||
</td>
|
|
||||||
</table>
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,5 +0,0 @@
|
||||||
all:
|
|
||||||
doxygen Doxygen_Release
|
|
||||||
cp ST_Logo.gif html
|
|
||||||
clean:
|
|
||||||
- rm -fr html
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @file error-def.h
|
* @file error-def.h
|
||||||
* @brief Return-code definitions for StZNet stack API functions.
|
* @brief Return-code definitions for API functions.
|
||||||
*
|
*
|
||||||
* See @ref status_codes for documentation.
|
* See @ref status_codes for documentation.
|
||||||
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
||||||
|
|
|
@ -31,13 +31,12 @@
|
||||||
|
|
||||||
// Keep micro first for specifics used by other headers
|
// Keep micro first for specifics used by other headers
|
||||||
#include "micro/micro-common.h"
|
#include "micro/micro-common.h"
|
||||||
#include "micro/cortexm3/micro-common.h"
|
|
||||||
|
|
||||||
#include "micro/led.h"
|
#include "micro/led.h"
|
||||||
#include "micro/button.h"
|
#include "micro/button.h"
|
||||||
#include "micro/system-timer.h"
|
#include "micro/system-timer.h"
|
||||||
#include "micro/cortexm3/nvm.h"
|
#include "micro/cortexm3/nvm.h"
|
||||||
#include "hal/micro/cortexm3/uart.h"
|
#include "hal/micro/cortexm3/uart.h"
|
||||||
|
#include "hal/micro/adc.h"
|
||||||
|
|
||||||
#endif //__HAL_H__
|
#endif //__HAL_H__
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
*
|
*
|
||||||
* To use the ADC system, include this file and ensure that
|
* To use the ADC system, include this file and ensure that
|
||||||
* ::halInternalInitAdc() is called whenever the microcontroller is
|
* ::halInternalInitAdc() is called whenever the microcontroller is
|
||||||
* started. Call ::halInternalSleepAdc() to sleep the module and
|
* started.
|
||||||
* ::halInternalInitAdc() to wake up the module.
|
|
||||||
*
|
*
|
||||||
* A "user" is a separate thread of execution and usage. That is,
|
* A "user" is a separate thread of execution and usage. That is,
|
||||||
* internal St code is one user and clients are a different user.
|
* internal St code is one user and clients are a different user.
|
||||||
|
@ -171,13 +170,6 @@ typedef int8u ADCChannelType;
|
||||||
*/
|
*/
|
||||||
void halInternalInitAdc(void);
|
void halInternalInitAdc(void);
|
||||||
|
|
||||||
|
|
||||||
/** @brief Shuts down the voltage reference and ADC system to
|
|
||||||
* minimize power consumption in sleep.
|
|
||||||
*/
|
|
||||||
void halInternalSleepAdc(void);
|
|
||||||
|
|
||||||
|
|
||||||
/** @brief Starts an ADC conversion for the user specified by \c id.
|
/** @brief Starts an ADC conversion for the user specified by \c id.
|
||||||
*
|
*
|
||||||
* @appusage The application must set \c reference to the voltage
|
* @appusage The application must set \c reference to the voltage
|
||||||
|
|
|
@ -117,6 +117,7 @@ ADCUser startNextConversion()
|
||||||
ADC_CFG = adcConfig[i]; // set the configuration to desired
|
ADC_CFG = adcConfig[i]; // set the configuration to desired
|
||||||
INT_ADCFLAG = 0xFFFF;
|
INT_ADCFLAG = 0xFFFF;
|
||||||
INT_CFGSET = INT_ADC;
|
INT_CFGSET = INT_ADC;
|
||||||
|
break; //see DDTS MBTst38936
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
453
cpu/stm32w108/hal/micro/cortexm3/board.c
Normal file
453
cpu/stm32w108/hal/micro/cortexm3/board.c
Normal file
|
@ -0,0 +1,453 @@
|
||||||
|
/** @file board.c
|
||||||
|
* @brief Board file x STM32W108 Kits boards
|
||||||
|
*
|
||||||
|
* This file implements a software layer to support all the ST kits boards
|
||||||
|
* and deal with the difference in leds, buttons and sensors connected to the board.
|
||||||
|
* This a bit too complex for customer boards adaptation and customer can simplify it
|
||||||
|
* to adapt it to their hardware environment as they normally don't need to have the software
|
||||||
|
* running on several boards.
|
||||||
|
* The boards supported are:
|
||||||
|
* - MB851 A
|
||||||
|
* - MB851 B
|
||||||
|
* - MB851 C
|
||||||
|
* - MB954 A
|
||||||
|
* - MB954 B
|
||||||
|
* - MB950 A
|
||||||
|
* - MB951 A
|
||||||
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
||||||
|
*/
|
||||||
|
#include PLATFORM_HEADER
|
||||||
|
#include BOARD_HEADER
|
||||||
|
#ifdef EMBERZNET_HAL
|
||||||
|
#include "stack/include/ember.h"
|
||||||
|
#include "stack/include/error.h"
|
||||||
|
#include "hal/hal.h"
|
||||||
|
#define PORTA (0 << 3)
|
||||||
|
#define PORTB (1 << 3)
|
||||||
|
#define PORTC (2 << 3)
|
||||||
|
#else
|
||||||
|
#include "error.h"
|
||||||
|
#include "hal/hal.h"
|
||||||
|
#include "hal/micro/cortexm3/mfg-token.h"
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
const LedResourceType LedsMB851A[] = {
|
||||||
|
{
|
||||||
|
"D1", /* Green LED */
|
||||||
|
PORTB,
|
||||||
|
6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"D3", /* Yellow LED */
|
||||||
|
PORTB,
|
||||||
|
5
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const InfraRedLedResourceType infraRedLedMB851A = {
|
||||||
|
"D5", /* Infrared LED */
|
||||||
|
PORTB,
|
||||||
|
4
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const LedResourceType LedsMB954A[] = {
|
||||||
|
{
|
||||||
|
"D1", /* Green LED */
|
||||||
|
PORTA,
|
||||||
|
5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"D3", /* Yellow LED */
|
||||||
|
PORTA,
|
||||||
|
0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ButtonResourceType ButtonsMB851A[] = {
|
||||||
|
{
|
||||||
|
"S1",
|
||||||
|
PORTA,
|
||||||
|
7
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ButtonResourceType ButtonsMB954A[] = {
|
||||||
|
{
|
||||||
|
"S1",
|
||||||
|
PORTB,
|
||||||
|
3
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ButtonResourceType ButtonsMB950A[] = {
|
||||||
|
{
|
||||||
|
"S1",
|
||||||
|
PORTB,
|
||||||
|
3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"S2",
|
||||||
|
PORTA,
|
||||||
|
7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"S3",
|
||||||
|
PORTB,
|
||||||
|
7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"S4",
|
||||||
|
PORTB,
|
||||||
|
0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"S5",
|
||||||
|
PORTB,
|
||||||
|
6
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const TempSensorResourceType tempSensorMB851A = {
|
||||||
|
"STLM20",
|
||||||
|
PORTB,
|
||||||
|
7,
|
||||||
|
FALSE
|
||||||
|
};
|
||||||
|
|
||||||
|
const TempSensorResourceType tempSensorMB954A = {
|
||||||
|
"STLM20",
|
||||||
|
PORTA,
|
||||||
|
4,
|
||||||
|
TRUE
|
||||||
|
};
|
||||||
|
|
||||||
|
const MemsResourceType memsSensor = {
|
||||||
|
"LIS302",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardIOType ioMB851A = {
|
||||||
|
LedsMB851A,
|
||||||
|
ButtonsMB851A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardIOType ioMB954A = {
|
||||||
|
LedsMB954A,
|
||||||
|
ButtonsMB954A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardIOType ioMB950A = {
|
||||||
|
LedsMB954A,
|
||||||
|
ButtonsMB950A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB851A = {
|
||||||
|
"MB851 A",
|
||||||
|
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_FTDI),
|
||||||
|
BUTTONS_MB851A,
|
||||||
|
LEDS_MB851A,
|
||||||
|
&ioMB851A,
|
||||||
|
&infraRedLedMB851A,
|
||||||
|
&memsSensor,
|
||||||
|
&tempSensorMB851A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB851B = {
|
||||||
|
"MB851 B",
|
||||||
|
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_FTDI),
|
||||||
|
BUTTONS_MB851B,
|
||||||
|
LEDS_MB851B,
|
||||||
|
&ioMB851A,
|
||||||
|
&infraRedLedMB851A,
|
||||||
|
&memsSensor,
|
||||||
|
&tempSensorMB851A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB851C = {
|
||||||
|
"MB851 C",
|
||||||
|
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_STM32F | BOARD_HAS_EEPROM),
|
||||||
|
BUTTONS_MB851C,
|
||||||
|
LEDS_MB851C,
|
||||||
|
&ioMB954A,
|
||||||
|
&infraRedLedMB851A,
|
||||||
|
&memsSensor,
|
||||||
|
&tempSensorMB954A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB954A = {
|
||||||
|
"MB954 A",
|
||||||
|
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_FTDI | BOARD_HAS_PA),
|
||||||
|
BUTTONS_MB954A,
|
||||||
|
LEDS_MB954A,
|
||||||
|
&ioMB954A,
|
||||||
|
&infraRedLedMB851A,
|
||||||
|
&memsSensor,
|
||||||
|
&tempSensorMB954A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB954B = {
|
||||||
|
"MB954 B",
|
||||||
|
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_STM32F | BOARD_HAS_EEPROM | BOARD_HAS_PA),
|
||||||
|
BUTTONS_MB954B,
|
||||||
|
LEDS_MB954B,
|
||||||
|
&ioMB954A,
|
||||||
|
&infraRedLedMB851A,
|
||||||
|
&memsSensor,
|
||||||
|
&tempSensorMB954A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB950A = {
|
||||||
|
"MB950 A",
|
||||||
|
(BOARD_HAS_MEMS | BOARD_HAS_TEMP_SENSOR | BOARD_HAS_STM32F),
|
||||||
|
BUTTONS_MB950A,
|
||||||
|
LEDS_MB950A,
|
||||||
|
&ioMB950A,
|
||||||
|
&infraRedLedMB851A,
|
||||||
|
&memsSensor,
|
||||||
|
&tempSensorMB954A,
|
||||||
|
};
|
||||||
|
|
||||||
|
const BoardResourcesType MB951A = {
|
||||||
|
"MB951 A",
|
||||||
|
(BOARD_HAS_STM32F),
|
||||||
|
BUTTONS_MB951A,
|
||||||
|
LEDS_MB951A,
|
||||||
|
&ioMB954A,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const BoardResourcesType *boardList [] = {
|
||||||
|
&MB851A,
|
||||||
|
&MB851B,
|
||||||
|
&MB851C,
|
||||||
|
&MB954A,
|
||||||
|
&MB954B,
|
||||||
|
&MB950A,
|
||||||
|
&MB951A
|
||||||
|
};
|
||||||
|
|
||||||
|
BoardResourcesType const *boardDescription = NULL;
|
||||||
|
|
||||||
|
#define PORT_NAME(x) ((x == PORTA) ? "A": ((x == PORTB) ? "B" : ((x == PORTC) ? "C": "?")))
|
||||||
|
|
||||||
|
void halBoardInit(void)
|
||||||
|
{
|
||||||
|
char boardName[16];
|
||||||
|
int8s i;
|
||||||
|
boardDescription = NULL;
|
||||||
|
#ifdef EMBERZNET_HAL
|
||||||
|
halCommonGetToken(boardName, TOKEN_MFG_BOARD_NAME);
|
||||||
|
#else
|
||||||
|
halCommonGetMfgToken(boardName, TOKEN_MFG_BOARD_NAME);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
i = 15;
|
||||||
|
while ((i >= 0) && (boardName[i] == 0xFF)) {
|
||||||
|
boardName[i] = 0;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < (sizeof(boardList)/4) ; i++)
|
||||||
|
if (strcmp(boardName, (boardList[i])->name) == 0) {
|
||||||
|
boardDescription = (BoardResourcesType *) boardList[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boardDescription == NULL) {
|
||||||
|
/* Board type not identified default to MB851A also to support legacy boards */
|
||||||
|
boardDescription = (BoardResourcesType *) &MB851A;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BoardResourcesType const *halBoardGetDescription(void)
|
||||||
|
{
|
||||||
|
return boardDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
void halBoardPowerDown(void)
|
||||||
|
{
|
||||||
|
/* Set everything to input value */
|
||||||
|
GPIO_PACFGL = (GPIOCFG_IN <<PA0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA1_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA2_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA3_CFG_BIT);
|
||||||
|
GPIO_PACFGH = (GPIOCFG_IN <<PA4_CFG_BIT)| /* PTI EN */
|
||||||
|
(GPIOCFG_IN <<PA5_CFG_BIT)| /* PTI_DATA */
|
||||||
|
(GPIOCFG_IN <<PA6_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA7_CFG_BIT);
|
||||||
|
GPIO_PBCFGL = (GPIOCFG_IN <<PB0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB1_CFG_BIT)| /* Uart TX */
|
||||||
|
(GPIOCFG_IN <<PB2_CFG_BIT)| /* Uart RX */
|
||||||
|
(GPIOCFG_IN <<PB3_CFG_BIT);
|
||||||
|
GPIO_PBCFGH = (GPIOCFG_IN <<PB4_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB5_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB6_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB7_CFG_BIT);
|
||||||
|
GPIO_PCCFGL = (GPIOCFG_IN <<PC0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC1_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC2_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC3_CFG_BIT);
|
||||||
|
GPIO_PCCFGH = (GPIOCFG_IN <<PC4_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC5_CFG_BIT)|
|
||||||
|
#ifdef EMBERZNET_HAL
|
||||||
|
(CFG_C6 <<PC6_CFG_BIT)| /* OSC32K */
|
||||||
|
(CFG_C7 <<PC7_CFG_BIT); /* OSC32K */
|
||||||
|
#else
|
||||||
|
(GPIOCFG_IN <<PC6_CFG_BIT)| /* OSC32K */
|
||||||
|
(GPIOCFG_IN <<PC7_CFG_BIT); /* OSC32K */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EMBERZNET_HAL
|
||||||
|
/* Configure GPIO for BUTTONSs */
|
||||||
|
{
|
||||||
|
ButtonResourceType *buttons = (ButtonResourceType *) boardDescription->io->buttons;
|
||||||
|
int8u i;
|
||||||
|
for (i = 0; i < boardDescription->buttons; i++) {
|
||||||
|
halGpioConfig(PORTx_PIN(buttons[i].gpioPort, buttons[i].gpioPin), GPIOCFG_IN_PUD);
|
||||||
|
halGpioSet(PORTx_PIN(buttons[i].gpioPort, buttons[i].gpioPin), GPIOOUT_PULLUP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Configure GPIO for power amplifier */
|
||||||
|
if (boardDescription->flags & BOARD_HAS_PA) {
|
||||||
|
/* SiGe Standby */
|
||||||
|
halGpioConfig(PORTB_PIN(6), GPIOCFG_OUT);
|
||||||
|
halGpioSet(PORTB_PIN(6), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
void halBoardPowerUp(void)
|
||||||
|
{
|
||||||
|
/* Set everything to input value */
|
||||||
|
GPIO_PACFGL = (GPIOCFG_IN <<PA0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA1_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA2_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA3_CFG_BIT);
|
||||||
|
GPIO_PACFGH = (GPIOCFG_IN <<PA4_CFG_BIT)| /* PTI EN */
|
||||||
|
(GPIOCFG_IN <<PA5_CFG_BIT)| /* PTI_DATA */
|
||||||
|
(GPIOCFG_IN <<PA6_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA7_CFG_BIT);
|
||||||
|
GPIO_PBCFGL = (GPIOCFG_IN <<PB0_CFG_BIT)|
|
||||||
|
(GPIOCFG_OUT_ALT <<PB1_CFG_BIT)| /* Uart TX */
|
||||||
|
(GPIOCFG_IN <<PB2_CFG_BIT)| /* Uart RX */
|
||||||
|
(GPIOCFG_IN <<PB3_CFG_BIT);
|
||||||
|
GPIO_PBCFGH = (GPIOCFG_IN <<PB4_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB5_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB6_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB7_CFG_BIT);
|
||||||
|
GPIO_PCCFGL = (GPIOCFG_IN <<PC0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC1_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC2_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC3_CFG_BIT);
|
||||||
|
GPIO_PCCFGH = (GPIOCFG_IN <<PC4_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC5_CFG_BIT)|
|
||||||
|
#ifdef EMBERZNET_HAL
|
||||||
|
(CFG_C6 <<PC6_CFG_BIT)| /* OSC32K */
|
||||||
|
(CFG_C7 <<PC7_CFG_BIT); /* OSC32K */
|
||||||
|
#else
|
||||||
|
(GPIOCFG_IN <<PC6_CFG_BIT)| /* OSC32K */
|
||||||
|
(GPIOCFG_IN <<PC7_CFG_BIT); /* OSC32K */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Configure GPIO for I2C access */
|
||||||
|
if ((boardDescription->flags & BOARD_HAS_MEMS) || (boardDescription->flags & BOARD_HAS_EEPROM)) {
|
||||||
|
halGpioConfig(PORTA_PIN(1), GPIOCFG_OUT_ALT_OD);
|
||||||
|
halGpioConfig(PORTA_PIN(2), GPIOCFG_OUT_ALT_OD);
|
||||||
|
}
|
||||||
|
/* Configure GPIO for ADC access (temp sensor) */
|
||||||
|
if (boardDescription->flags & BOARD_HAS_TEMP_SENSOR) {
|
||||||
|
halGpioConfig(PORTx_PIN(boardDescription->temperatureSensor->gpioPort,
|
||||||
|
boardDescription->temperatureSensor->gpioPin),
|
||||||
|
GPIOCFG_ANALOG);
|
||||||
|
}
|
||||||
|
/* Configure GPIO for LEDs */
|
||||||
|
{
|
||||||
|
LedResourceType *leds = (LedResourceType *) boardDescription->io->leds;
|
||||||
|
int8u i;
|
||||||
|
for (i = 0; i < boardDescription->leds; i++) {
|
||||||
|
/* LED default off */
|
||||||
|
halGpioConfig(PORTx_PIN(leds[i].gpioPort, leds[i].gpioPin), GPIOCFG_OUT);
|
||||||
|
halGpioSet(PORTx_PIN(leds[i].gpioPort, leds[i].gpioPin), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Configure GPIO for BUTTONSs */
|
||||||
|
{
|
||||||
|
ButtonResourceType *buttons = (ButtonResourceType *) boardDescription->io->buttons;
|
||||||
|
int8u i;
|
||||||
|
for (i = 0; i < boardDescription->buttons; i++) {
|
||||||
|
halGpioConfig(PORTx_PIN(buttons[i].gpioPort, buttons[i].gpioPin), GPIOCFG_IN_PUD);
|
||||||
|
halGpioSet(PORTx_PIN(buttons[i].gpioPort, buttons[i].gpioPin), GPIOOUT_PULLUP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure GPIO for power amplifier */
|
||||||
|
if (boardDescription->flags & BOARD_HAS_PA) {
|
||||||
|
/* SiGe Ant Sel (default ceramic antenna) */
|
||||||
|
halGpioConfig(PORTB_PIN(5), GPIOCFG_OUT);
|
||||||
|
halGpioSet(PORTB_PIN(5), 1);
|
||||||
|
/* SiGe Standby (default out of standby) */
|
||||||
|
halGpioConfig(PORTB_PIN(6), GPIOCFG_OUT);
|
||||||
|
halGpioSet(PORTB_PIN(6), 1);
|
||||||
|
/* SiGe LNA (default LNA off )*/
|
||||||
|
halGpioConfig(PORTB_PIN(7), GPIOCFG_OUT);
|
||||||
|
halGpioSet(PORTB_PIN(7), 0);
|
||||||
|
/* SiGe nTX Active */
|
||||||
|
halGpioConfig(PORTC_PIN(5), GPIOCFG_OUT_ALT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef TEST_COMMANDS
|
||||||
|
#include <stdio.h>
|
||||||
|
void printLeds (LedResourceType *leds)
|
||||||
|
{
|
||||||
|
while (leds->name != NULL) {
|
||||||
|
printf ("Led %s (port:%s, bit:%d)\r\n", leds->name, PORT_NAME(leds->gpioPort), leds->gpioPin);
|
||||||
|
leds++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printButtons (ButtonResourceType *buttons)
|
||||||
|
{
|
||||||
|
while (buttons->name != NULL) {
|
||||||
|
printf ("Button %s (port:%s, bit:%d)\r\n", buttons->name, PORT_NAME(buttons->gpioPort), buttons->gpioPin);
|
||||||
|
buttons++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void boardPrintStringDescription(void)
|
||||||
|
{
|
||||||
|
int8u i = 0;
|
||||||
|
|
||||||
|
while (boardList[i] != NULL) {
|
||||||
|
if ((boardDescription == boardList[i]) || (boardDescription == NULL)) {
|
||||||
|
BoardResourcesType *ptr = boardList[i];
|
||||||
|
printf ("*************************************\r\n");
|
||||||
|
printf ("Board name = %s\r\n", ptr->name);
|
||||||
|
printf ("*************************************\r\n");
|
||||||
|
printLeds(ptr->leds);
|
||||||
|
printButtons(ptr->buttons);
|
||||||
|
if (ptr->mems) {
|
||||||
|
printf ("MEMS = %s\r\n", ptr->mems->name);
|
||||||
|
}
|
||||||
|
if (ptr->temperatureSensor) {
|
||||||
|
printf ("Temp sensor = %s, port:%s, pin:%d, adcFix:%s\r\n",
|
||||||
|
ptr->temperatureSensor->name,
|
||||||
|
PORT_NAME(ptr->temperatureSensor->gpioPort),
|
||||||
|
ptr->temperatureSensor->gpioPin,
|
||||||
|
ptr->temperatureSensor->adcFix ? "Yes" : "No"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
printf ("EEProm:%s\r\n", ptr->EEProm ? "Yes" : "No");
|
||||||
|
printf ("PC i/f:%s\r\n", ptr->FTDInotSTM32 ? "FTDI" : "STM32F");
|
||||||
|
printf ("Power Amplifier:%s\r\n", ptr->PowerAmplifier ? "Yes" : "No");
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -12,18 +12,25 @@
|
||||||
|
|
||||||
void halInitButton(void)
|
void halInitButton(void)
|
||||||
{
|
{
|
||||||
/* Set GPIO pin to PUD (input pull-up or pull-down) for button S1 */
|
int8u i;
|
||||||
halGpioConfig(BUTTON_S1,GPIOCFG_IN_PUD);
|
/* Configure GPIO for BUTTONSs */
|
||||||
/* Set the button S1 gpio pin to pull-up */
|
ButtonResourceType *buttons = (ButtonResourceType *) boardDescription->io->buttons;
|
||||||
BUTTON_S1_OUTPUT_GPIO |= GPIOOUT_PULLUP << BUTTON_S1_GPIO_PIN;
|
for (i = 0; i < boardDescription->buttons; i++) {
|
||||||
|
halGpioConfig(PORTx_PIN(buttons[i].gpioPort, buttons[i].gpioPin), GPIOCFG_IN_PUD);
|
||||||
|
halGpioSet(PORTx_PIN(buttons[i].gpioPort, buttons[i].gpioPin), GPIOOUT_PULLUP);
|
||||||
|
}
|
||||||
}/* end halInitButton() */
|
}/* end halInitButton() */
|
||||||
|
|
||||||
|
|
||||||
int8u halGetButtonStatus(HalBoardButton button)
|
int8u halGetButtonStatus(HalBoardButton button)
|
||||||
{
|
{
|
||||||
if (button == BUTTON_S1)
|
int8u port = (button >> 3) & 0xf;
|
||||||
return (BUTTON_S1_INPUT_GPIO & (1<<BUTTON_S1_GPIO_PIN)) ? BUTTON_RELEASED : BUTTON_PRESSED;
|
int8u pin = button & 0x7;
|
||||||
else
|
|
||||||
|
if (button != DUMMY_BUTTON)
|
||||||
|
{
|
||||||
|
return (BUTTON_INPUT_GPIO(port) & (1 << pin)) ? BUTTON_RELEASED : BUTTON_PRESSED;
|
||||||
|
}
|
||||||
return BUTTON_UNKNOWN;
|
return BUTTON_UNKNOWN;
|
||||||
}/* end halGetButtonStatus()*/
|
}/* end halGetButtonStatus()*/
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,17 @@
|
||||||
#error Improper PLATFORM_HEADER
|
#error Improper PLATFORM_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
#if (__GNUC__ < 4)
|
||||||
+ __GNUC_MINOR__ * 100 \
|
#error Only GNU C versions later than 4.3.2 are supported
|
||||||
+ __GNUC_PATCHLEVEL__)
|
#elif (__GNUC__ == 4)
|
||||||
|
#if (__GNUC_MINOR__ < 3)
|
||||||
#if GCC_VERSION < 40302
|
#error Only GNU C versions later than 4.3.2 are supported
|
||||||
#error Only GNU C version later than 4.3.2 are supported
|
#elif (__GNUC_MINOR__ == 3)
|
||||||
#endif
|
#if (__GNUC_PATCHLEVEL__ < 2)
|
||||||
|
#error Only GNU C versions later than 4.3.2 are supported
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif // __GNUC__
|
||||||
|
|
||||||
|
|
||||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
@ -36,6 +40,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#if defined (CORTEXM3_STM32W108)
|
#if defined (CORTEXM3_STM32W108)
|
||||||
#include "micro/cortexm3/stm32w108/regs.h"
|
#include "micro/cortexm3/stm32w108/regs.h"
|
||||||
|
#include "micro/cortexm3/stm32w108/stm32w108_type.h"
|
||||||
#else
|
#else
|
||||||
#error Unknown CORTEXM3 micro
|
#error Unknown CORTEXM3 micro
|
||||||
#endif
|
#endif
|
||||||
|
@ -169,6 +174,16 @@ typedef unsigned int PointerType;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the application start and end address.
|
||||||
|
* This are useful to detect whether an image is for bootloader mode or not.
|
||||||
|
* This can be used also to clone image to another node via bootloader.
|
||||||
|
*/
|
||||||
|
#define APPLICATION_IMAGE_START ((u32) &__ApplicationFlashStart)
|
||||||
|
#define APPLICATION_IMAGE_END ((u32) &__ApplicationFlashEnd)
|
||||||
|
extern char __ApplicationFlashStart;
|
||||||
|
extern char __ApplicationFlashEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Macro to reset the watchdog timer. Note: be very very
|
* @brief Macro to reset the watchdog timer. Note: be very very
|
||||||
* careful when using this as you can easily get into an infinite loop if you
|
* careful when using this as you can easily get into an infinite loop if you
|
||||||
|
@ -252,6 +267,9 @@ void halInternalResetWatchDog(void);
|
||||||
#define VAR_AT_SEGMENT(__variableDeclaration, __segmentName) \
|
#define VAR_AT_SEGMENT(__variableDeclaration, __segmentName) \
|
||||||
__variableDeclaration __attribute__ ((section (__segmentName)))
|
__variableDeclaration __attribute__ ((section (__segmentName)))
|
||||||
|
|
||||||
|
#define ALIGN_VAR(__variableDeclaration, alignment) \
|
||||||
|
__variableDeclaration __attribute__ ((aligned(alignment)))
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//@} // end of Miscellaneous Macros
|
//@} // end of Miscellaneous Macros
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#if defined (CORTEXM3_STM32W108)
|
#if defined (CORTEXM3_STM32W108)
|
||||||
#include "micro/cortexm3/stm32w108/regs.h"
|
#include "micro/cortexm3/stm32w108/regs.h"
|
||||||
|
#include "micro/cortexm3/stm32w108/stm32w108_type.h"
|
||||||
|
#elif defined (CORTEXM3_STM32F103)
|
||||||
|
#include "stm32f10x.h"
|
||||||
#else
|
#else
|
||||||
#error Unknown CORTEXM3 micro
|
#error Unknown CORTEXM3 micro
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,6 +166,15 @@ typedef unsigned int PointerType;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the application start and end address.
|
||||||
|
* This are useful to detect whether an image is for bootloader mode or not.
|
||||||
|
* This can be used also to clone image to another node via bootloader.
|
||||||
|
*/
|
||||||
|
#define APPLICATION_IMAGE_START ((u32) __section_begin("FLASH_IMAGE"))
|
||||||
|
#define APPLICATION_IMAGE_END ((u32) __section_end ("FLASH_IMAGE"))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Macro to reset the watchdog timer. Note: be very very
|
* @brief Macro to reset the watchdog timer. Note: be very very
|
||||||
* careful when using this as you can easily get into an infinite loop if you
|
* careful when using this as you can easily get into an infinite loop if you
|
||||||
|
@ -247,6 +259,11 @@ void halInternalResetWatchDog(void);
|
||||||
#define VAR_AT_SEGMENT(__variableDeclaration, __segmentName) \
|
#define VAR_AT_SEGMENT(__variableDeclaration, __segmentName) \
|
||||||
__variableDeclaration @ __segmentName
|
__variableDeclaration @ __segmentName
|
||||||
|
|
||||||
|
#define _QUOTEME(a) #a
|
||||||
|
#define QUOTEME(a) _QUOTEME(a)
|
||||||
|
#define ALIGN_VAR(__variableDeclaration, alignment) _Pragma(QUOTEME(data_alignment=alignment)) \
|
||||||
|
__variableDeclaration
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//@} // end of Miscellaneous Macros
|
//@} // end of Miscellaneous Macros
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -290,6 +307,8 @@ void halInternalResetWatchDog(void);
|
||||||
#pragma segment=__TEXTRW__
|
#pragma segment=__TEXTRW__
|
||||||
#pragma segment=__FAT__
|
#pragma segment=__FAT__
|
||||||
#pragma segment=__NVM__
|
#pragma segment=__NVM__
|
||||||
|
// Special pragma to get the application image start and end address
|
||||||
|
#pragma segment="FLASH_IMAGE"
|
||||||
/**@} */
|
/**@} */
|
||||||
|
|
||||||
//A utility function for inserting barrier instructions. These
|
//A utility function for inserting barrier instructions. These
|
||||||
|
|
34
cpu/stm32w108/hal/micro/cortexm3/iap_bootloader.h
Normal file
34
cpu/stm32w108/hal/micro/cortexm3/iap_bootloader.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/** @file iap_bootloader.h
|
||||||
|
* @brief IAP bootloader specific definitions
|
||||||
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Application start address
|
||||||
|
*/
|
||||||
|
#define IAP_BOOTLOADER_APPLICATION_ADDRESS 0x08003000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Radio PAN ID for OTA bootloader
|
||||||
|
*/
|
||||||
|
#define IAP_BOOTLOADER_PAN_ID 0xb00b
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Signature used for switch to application
|
||||||
|
*/
|
||||||
|
#define IAP_BOOTLOADER_APP_SWITCH_SIGNATURE 0xb001204d
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Radio default channel for OTA bootloader
|
||||||
|
*/
|
||||||
|
#define IAP_BOOTLOADER_DEFAULT_CHANNEL 0x0F
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IAP bootloader uart mode
|
||||||
|
*/
|
||||||
|
#define IAP_BOOTLOADER_MODE_UART 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IAP bootloader OTA mode
|
||||||
|
*/
|
||||||
|
#define IAP_BOOTLOADER_MODE_OTA 1
|
|
@ -10,12 +10,6 @@
|
||||||
#include "hal/micro/micro-common.h"
|
#include "hal/micro/micro-common.h"
|
||||||
#include "hal/micro/cortexm3/micro-common.h"
|
#include "hal/micro/cortexm3/micro-common.h"
|
||||||
|
|
||||||
#define GPIO_PxCLR_BASE (GPIO_PACLR_ADDR)
|
|
||||||
#define GPIO_PxSET_BASE (GPIO_PASET_ADDR)
|
|
||||||
#define GPIO_PxOUT_BASE (GPIO_PAOUT_ADDR)
|
|
||||||
// Each port is offset from the previous port by the same amount
|
|
||||||
#define GPIO_Px_OFFSET (GPIO_PBCFGL_ADDR-GPIO_PACFGL_ADDR)
|
|
||||||
|
|
||||||
void halInitLed(void)
|
void halInitLed(void)
|
||||||
{
|
{
|
||||||
/* Set GPIO pins for Led D1 and Led D3 */
|
/* Set GPIO pins for Led D1 and Led D3 */
|
||||||
|
@ -28,16 +22,12 @@ void halInitLed(void)
|
||||||
|
|
||||||
void halSetLed(HalBoardLed led)
|
void halSetLed(HalBoardLed led)
|
||||||
{
|
{
|
||||||
if(led/8 < 3) {
|
halGpioSet(led, 0);
|
||||||
*((volatile int32u *)(GPIO_PxCLR_BASE+(GPIO_Px_OFFSET*(led/8)))) = BIT(led&7);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void halClearLed(HalBoardLed led)
|
void halClearLed(HalBoardLed led)
|
||||||
{
|
{
|
||||||
if(led/8 < 3) {
|
halGpioSet(led, 1);
|
||||||
*((volatile int32u *)(GPIO_PxSET_BASE+(GPIO_Px_OFFSET*(led/8)))) = BIT(led&7);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void halToggleLed(HalBoardLed led)
|
void halToggleLed(HalBoardLed led)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#ifndef LOADER
|
#ifndef LOADER
|
||||||
#if defined (CORTEXM3_STM32W108)
|
#if defined (CORTEXM3_STM32W108)
|
||||||
#include "hal/micro/cortexm3/stm32w108/memmap.h"
|
#include "hal/micro/cortexm3/stm32w108/memmap.h"
|
||||||
|
#elif defined (CORTEXM3_STM32F103)
|
||||||
|
#include "hal/micro/cortexm3/stm32f103ret/memmap.h"
|
||||||
#else
|
#else
|
||||||
#error no appropriate micro defined
|
#error no appropriate micro defined
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -250,7 +250,7 @@ void halInternalSetRegTrim(boolean boostMode)
|
||||||
// the accuracy of OSCHF (much lower than XTAL).
|
// the accuracy of OSCHF (much lower than XTAL).
|
||||||
void halCommonDelayMicroseconds(int16u us)
|
void halCommonDelayMicroseconds(int16u us)
|
||||||
{
|
{
|
||||||
int32u beginTime = MAC_TIMER;
|
int32u beginTime = ReadRegister(MAC_TIMER);
|
||||||
|
|
||||||
//If we're not using the XTAL, the MAC Timer is running off OSCHF,
|
//If we're not using the XTAL, the MAC Timer is running off OSCHF,
|
||||||
//that means the clock is half speed, 6MHz. We need to halve our delay
|
//that means the clock is half speed, 6MHz. We need to halve our delay
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include PLATFORM_HEADER
|
#include PLATFORM_HEADER
|
||||||
|
#include BOARD_HEADER
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "hal/micro/micro-common.h"
|
#include "hal/micro/micro-common.h"
|
||||||
#include "hal/micro/cortexm3/micro-common.h"
|
#include "hal/micro/cortexm3/micro-common.h"
|
||||||
|
@ -59,11 +60,16 @@ void halGpioConfig(int32u io, int32u config)
|
||||||
*configRegs[io/4] = portcfg | (config <<((io&3)*4));
|
*configRegs[io/4] = portcfg | (config <<((io&3)*4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void halGpioSet(int32u gpio, boolean value)
|
||||||
|
{
|
||||||
|
if(gpio/8 < 3) {
|
||||||
|
if (value) {
|
||||||
|
*((volatile int32u *)(GPIO_PxSET_BASE+(GPIO_Px_OFFSET*(gpio/8)))) = BIT(gpio&7);
|
||||||
|
} else {
|
||||||
|
*((volatile int32u *)(GPIO_PxCLR_BASE+(GPIO_Px_OFFSET*(gpio/8)))) = BIT(gpio&7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int16u halInternalStartSystemTimer(void)
|
int16u halInternalStartSystemTimer(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,24 +24,35 @@
|
||||||
#endif //__STSTATUS_TYPE__
|
#endif //__STSTATUS_TYPE__
|
||||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
|
#define PORTA (0 << 3)
|
||||||
|
#define PORTB (1 << 3)
|
||||||
|
#define PORTC (2 << 3)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Some registers and variables require indentifying GPIO by
|
* @brief Some registers and variables require indentifying GPIO by
|
||||||
* a single number instead of the port and pin. This macro converts
|
* a single number instead of the port and pin. This macro converts
|
||||||
* Port A pins into a single number.
|
* Port A pins into a single number.
|
||||||
*/
|
*/
|
||||||
#define PORTA_PIN(y) ((0<<3)|y)
|
#define PORTA_PIN(y) (PORTA|y)
|
||||||
/**
|
/**
|
||||||
* @brief Some registers and variables require indentifying GPIO by
|
* @brief Some registers and variables require indentifying GPIO by
|
||||||
* a single number instead of the port and pin. This macro converts
|
* a single number instead of the port and pin. This macro converts
|
||||||
* Port B pins into a single number.
|
* Port B pins into a single number.
|
||||||
*/
|
*/
|
||||||
#define PORTB_PIN(y) ((1<<3)|y)
|
#define PORTB_PIN(y) (PORTB|y)
|
||||||
/**
|
/**
|
||||||
* @brief Some registers and variables require indentifying GPIO by
|
* @brief Some registers and variables require indentifying GPIO by
|
||||||
* a single number instead of the port and pin. This macro converts
|
* a single number instead of the port and pin. This macro converts
|
||||||
* Port C pins into a single number.
|
* Port C pins into a single number.
|
||||||
*/
|
*/
|
||||||
#define PORTC_PIN(y) ((2<<3)|y)
|
#define PORTC_PIN(y) (PORTC|y)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Some registers and variables require indentifying GPIO by
|
||||||
|
* a single number instead of the port and pin. This macro converts
|
||||||
|
* Port C pins into a single number.
|
||||||
|
*/
|
||||||
|
#define PORTx_PIN(x, y) (x|y)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Resets the watchdog timer. This function is pointed
|
* @brief Resets the watchdog timer. This function is pointed
|
||||||
|
@ -62,6 +73,16 @@ void halInternalResetWatchDog( void );
|
||||||
*/
|
*/
|
||||||
void halGpioConfig(int32u io, int32u config);
|
void halGpioConfig(int32u io, int32u config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set/Clear single GPIO bit
|
||||||
|
*
|
||||||
|
* @param io The io pin to use, can be specified with the convenience macros
|
||||||
|
* PORTA_PIN(), PORTB_PIN(), PORTC_PIN()
|
||||||
|
* @param value A flag indicating whether to set or clear the io.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void halGpioSet(int32u io, boolean value);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calibrates the internal SlowRC to generate a 1024 Hz (1kHz) clock.
|
* @brief Calibrates the internal SlowRC to generate a 1024 Hz (1kHz) clock.
|
||||||
|
|
|
@ -6,15 +6,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include PLATFORM_HEADER
|
#include PLATFORM_HEADER
|
||||||
|
#include BOARD_HEADER
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "hal/micro/micro-common.h"
|
#include "hal/micro/micro-common.h"
|
||||||
#include "hal/micro/cortexm3/micro-common.h"
|
#include "hal/micro/cortexm3/micro-common.h"
|
||||||
#include "micro/system-timer.h"
|
#include "micro/system-timer.h"
|
||||||
#include "micro/adc.h"
|
#include "micro/adc.h"
|
||||||
|
#include "micro/cortexm3/memmap.h"
|
||||||
|
#include "micro/cortexm3/iap_bootloader.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
extern void halBoardInit(void);
|
||||||
|
|
||||||
void halInit(void)
|
void halInit(void)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +28,7 @@ void halInit(void)
|
||||||
//be deleted.
|
//be deleted.
|
||||||
GPIO_DBGCFG &= ~GPIO_EXTREGEN;
|
GPIO_DBGCFG &= ~GPIO_EXTREGEN;
|
||||||
halInternalSetRegTrim(FALSE);
|
halInternalSetRegTrim(FALSE);
|
||||||
|
halBoardInit();
|
||||||
halPowerUp();
|
halPowerUp();
|
||||||
halInternalCalibrateFastRc();
|
halInternalCalibrateFastRc();
|
||||||
|
|
||||||
|
@ -54,6 +59,7 @@ void halReboot(void)
|
||||||
|
|
||||||
void halPowerDown(void)
|
void halPowerDown(void)
|
||||||
{
|
{
|
||||||
|
halBoardPowerDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void halPowerUp(void)
|
void halPowerUp(void)
|
||||||
|
@ -61,6 +67,7 @@ void halPowerUp(void)
|
||||||
halInternalInitAdc();
|
halInternalInitAdc();
|
||||||
halCommonCalibratePads();
|
halCommonCalibratePads();
|
||||||
halInternalSwitchToXtal();
|
halInternalSwitchToXtal();
|
||||||
|
halBoardPowerUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16u seed0 = 0xbeef;
|
static int16u seed0 = 0xbeef;
|
||||||
|
@ -106,3 +113,43 @@ void halCommonMemSet(void *dest, int8u val, int16u bytes)
|
||||||
{
|
{
|
||||||
memset(dest, val, bytes);
|
memset(dest, val, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct appSwitchStruct {
|
||||||
|
int32u signature;
|
||||||
|
int8u mode;
|
||||||
|
int8u channel;
|
||||||
|
union {
|
||||||
|
int16u panID;
|
||||||
|
int16u offset;
|
||||||
|
} param;
|
||||||
|
} appSwitchStructType;
|
||||||
|
#pragma pack()
|
||||||
|
static appSwitchStructType *appSwitch = (appSwitchStructType *) RAM_BOTTOM;
|
||||||
|
|
||||||
|
StStatus halBootloaderStart(int8u mode, int8u channel, int16u panID)
|
||||||
|
{
|
||||||
|
if (mode == IAP_BOOTLOADER_MODE_UART) {
|
||||||
|
int8u cut = *(volatile int8u *) 0x08040798;
|
||||||
|
if (!( (halFixedAddressTable.baseTable.type == FIXED_ADDRESS_TABLE_TYPE) &&
|
||||||
|
( ( (halFixedAddressTable.baseTable.version & FAT_MAJOR_VERSION_MASK)
|
||||||
|
== 0x0000 ) &&
|
||||||
|
(halFixedAddressTable.baseTable.version == 0x0003) //checking presence of valid version
|
||||||
|
) && (cut >= 2) && (cut <= 3)))
|
||||||
|
/* Cut not supported */
|
||||||
|
return ST_ERR_FATAL;
|
||||||
|
} else {
|
||||||
|
/* Check that OTA bootloader is at the base of the flash */
|
||||||
|
if (*((int32u *) (MFB_BOTTOM + 28)) == IAP_BOOTLOADER_APP_SWITCH_SIGNATURE) {
|
||||||
|
appSwitch->channel = ((channel >= 11) && (channel <= 26)) ? channel :IAP_BOOTLOADER_DEFAULT_CHANNEL;
|
||||||
|
appSwitch->param.panID = panID;
|
||||||
|
} else {
|
||||||
|
return ST_ERR_FATAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
appSwitch->signature = IAP_BOOTLOADER_APP_SWITCH_SIGNATURE;
|
||||||
|
appSwitch->mode = mode;
|
||||||
|
halReboot();
|
||||||
|
|
||||||
|
return (mode <= IAP_BOOTLOADER_MODE_OTA) ? ST_ERR_FATAL: ST_BAD_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,30 @@
|
||||||
|
|
||||||
#include PLATFORM_HEADER
|
#include PLATFORM_HEADER
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#ifdef NVM_RAM_EMULATION
|
||||||
|
|
||||||
|
static int16u calibrationData[32+2]={
|
||||||
|
0xFFFF, 0xFFFF,
|
||||||
|
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||||
|
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||||
|
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||||
|
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||||
|
};
|
||||||
|
|
||||||
|
int8u halCommonReadFromNvm(void *data, int32u offset, int16u length)
|
||||||
|
{
|
||||||
|
halCommonMemCopy(data, ((int8u *) calibrationData) + offset, length);
|
||||||
|
return ST_SUCCESS;
|
||||||
|
}
|
||||||
|
int8u halCommonWriteToNvm(const void *data, int32u offset, int16u length)
|
||||||
|
{
|
||||||
|
halCommonMemCopy(((int8u *) calibrationData) + offset, data, length);
|
||||||
|
return ST_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
//flash.h gives access to halInternalFlashErase and halInternalFlashWrite.
|
//flash.h gives access to halInternalFlashErase and halInternalFlashWrite.
|
||||||
#include "hal/micro/cortexm3/flash.h"
|
#include "hal/micro/cortexm3/flash.h"
|
||||||
//nvm.h includes memmap.h. These two headers define the key parameters:
|
//nvm.h includes memmap.h. These two headers define the key parameters:
|
||||||
|
@ -375,3 +399,4 @@ int8u halCommonWriteToNvm(const void *data, int32u offset, int16u length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // NVM_RAM_EMULATION
|
||||||
|
|
|
@ -99,9 +99,9 @@ _disableBasePri:
|
||||||
_basePriIsDisabled:
|
_basePriIsDisabled:
|
||||||
MRS R0, BASEPRI // read current BASEPRI
|
MRS R0, BASEPRI // read current BASEPRI
|
||||||
CMP R0, #INTERRUPTS_DISABLED_PRIORITY
|
CMP R0, #INTERRUPTS_DISABLED_PRIORITY
|
||||||
ITE le
|
ITE lt
|
||||||
LDRLE R0, =1
|
LDRLT R0, =0
|
||||||
LDRGT R0, =0
|
LDRGE R0, =1
|
||||||
BX LR
|
BX LR
|
||||||
__CFI__(EndBlock cfiBlock3)
|
__CFI__(EndBlock cfiBlock3)
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,221 @@
|
||||||
/** @file board.h
|
/** @file board.h
|
||||||
* @brief Header file x STM32W108 Kits boards
|
* @brief Header file x STM32W108 Kits boards abstraction.
|
||||||
|
* See @ref board for documentation.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* See hal/micro/cortexm3/stm32w108/board.h for source code.
|
||||||
*
|
*
|
||||||
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
||||||
*/
|
*/
|
||||||
#ifndef _BOARD_H_
|
#ifndef _BOARD_H_
|
||||||
#define _BOARD_H_
|
#define _BOARD_H_
|
||||||
|
|
||||||
#ifdef BOARD_MB851
|
/** @addtogroup board
|
||||||
|
* @brief ST board abstraction layer
|
||||||
|
*
|
||||||
|
* This header defines API and data structures to handle ST boards with thei associated resources
|
||||||
|
* on algorithm behavior.
|
||||||
|
* See hal/micro/cortexm3/stm32w108/board.h for source code.
|
||||||
|
*@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB851A 2
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB851B 2
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB851C 2
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB954A 2
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB954B 2
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB950A 2
|
||||||
|
/**
|
||||||
|
* @brief Define the number of LEDs in the specific board revision
|
||||||
|
*/
|
||||||
|
#define LEDS_MB951A 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB851A 1
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB851B 1
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB851C 1
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB954A 1
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB954B 1
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB950A 5
|
||||||
|
/**
|
||||||
|
* @brief Define the number of user buttons in the specific board revision
|
||||||
|
*/
|
||||||
|
#define BUTTONS_MB951A 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data structure for led description
|
||||||
|
*/
|
||||||
|
typedef struct LedResourceStruct {
|
||||||
|
/** Name of the LED as printed in the board */
|
||||||
|
char *name;
|
||||||
|
/** GPIO port associated with the LED */
|
||||||
|
int8u gpioPort;
|
||||||
|
/** GPIO pin associated with the LED */
|
||||||
|
int8u gpioPin;
|
||||||
|
} LedResourceType;
|
||||||
|
|
||||||
|
typedef LedResourceType InfraRedLedResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data structure for button description
|
||||||
|
*/
|
||||||
|
typedef struct ButtonResourceStruct {
|
||||||
|
/** Name of the button as printed in the board */
|
||||||
|
char *name;
|
||||||
|
/** GPIO port associated with the button */
|
||||||
|
int8u gpioPort;
|
||||||
|
/** GPIO pin associated with the button */
|
||||||
|
int8u gpioPin;
|
||||||
|
} ButtonResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data structure for MEMS description
|
||||||
|
*/
|
||||||
|
typedef struct MemsResourceStruct {
|
||||||
|
/** Name of the MEMS device */
|
||||||
|
char *name;
|
||||||
|
/** Serial communication port associated with the MEMS */
|
||||||
|
int8u scPort;
|
||||||
|
} MemsResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data structure for temperature sensor description
|
||||||
|
*/
|
||||||
|
typedef struct TempSensorResourceStruct {
|
||||||
|
/** Name of the temperature sensor device */
|
||||||
|
char *name;
|
||||||
|
/** GPIO port associated with the sensor */
|
||||||
|
int8u gpioPort;
|
||||||
|
/** GPIO pin associated with the sensor */
|
||||||
|
int8u gpioPin;
|
||||||
|
/** Flag to indicate whether the ADC range extension bug fix is implemented */
|
||||||
|
boolean adcFix;
|
||||||
|
} TempSensorResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data structure for board user I/O
|
||||||
|
*/
|
||||||
|
typedef struct BoardIOStruct {
|
||||||
|
/** Pointer to LED resources */
|
||||||
|
const LedResourceType *leds;
|
||||||
|
/** Pointer to button resources */
|
||||||
|
const ButtonResourceType *buttons;
|
||||||
|
} BoardIOType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Flag to indicate if MEMS is present
|
||||||
|
*/
|
||||||
|
#define BOARD_HAS_MEMS (1 << 0)
|
||||||
|
/**
|
||||||
|
* @brief Flag to indicate if temeprature sensor is present
|
||||||
|
*/
|
||||||
|
#define BOARD_HAS_TEMP_SENSOR (1 << 1)
|
||||||
|
/**
|
||||||
|
* @brief Flag to indicate if external power amplifier is present
|
||||||
|
*/
|
||||||
|
#define BOARD_HAS_PA (1 << 2)
|
||||||
|
/**
|
||||||
|
* @brief Flag to indicate if EEPROM is present
|
||||||
|
*/
|
||||||
|
#define BOARD_HAS_EEPROM (1 << 3)
|
||||||
|
/**
|
||||||
|
* @brief Flag to indicate if FTDI is used as PC interface
|
||||||
|
*/
|
||||||
|
#define BOARD_HAS_FTDI (1 << 4)
|
||||||
|
/**
|
||||||
|
* @brief Flag to indicate if STM32F is used as PC interface
|
||||||
|
*/
|
||||||
|
#define BOARD_HAS_STM32F (1 << 5)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data structure describing board features
|
||||||
|
*/
|
||||||
|
typedef struct BoardResourcesStruct {
|
||||||
|
const char *name;
|
||||||
|
const int32u flags;
|
||||||
|
/** Number of buttons */
|
||||||
|
int8u buttons;
|
||||||
|
/** Number of leds */
|
||||||
|
int8u leds;
|
||||||
|
/** Board I/O description */
|
||||||
|
const BoardIOType *io;
|
||||||
|
/** Board infrared led description */
|
||||||
|
const InfraRedLedResourceType* infraredLed;
|
||||||
|
/** Board infrared MEMS description */
|
||||||
|
const MemsResourceType *mems;
|
||||||
|
/** Board infrared temeprature sensor description */
|
||||||
|
const TempSensorResourceType *temperatureSensor;
|
||||||
|
} BoardResourcesType;
|
||||||
|
|
||||||
|
extern BoardResourcesType const *boardDescription;
|
||||||
|
|
||||||
|
// Generic definitions
|
||||||
|
#define GPIO_PxCLR_BASE (GPIO_PACLR_ADDR)
|
||||||
|
#define GPIO_PxSET_BASE (GPIO_PASET_ADDR)
|
||||||
|
#define GPIO_PxOUT_BASE (GPIO_PAOUT_ADDR)
|
||||||
|
#define GPIO_PxIN_BASE (GPIO_PAIN_ADDR)
|
||||||
|
// Each port is offset from the previous port by the same amount
|
||||||
|
#define GPIO_Px_OFFSET (GPIO_PBCFGL_ADDR-GPIO_PACFGL_ADDR)
|
||||||
|
|
||||||
|
|
||||||
/* leds definitions */
|
/* leds definitions */
|
||||||
#define LED_D1 PORTB_PIN(6)
|
#define LED_D1 PORTx_PIN(boardDescription->io->leds[0].gpioPort, boardDescription->io->leds[0].gpioPin) //PORTB_PIN(6)
|
||||||
#define LED_D3 PORTB_PIN(5)
|
#define LED_D3 PORTx_PIN(boardDescription->io->leds[1].gpioPort, boardDescription->io->leds[1].gpioPin) // PORTB_PIN(5)
|
||||||
|
#define DUMMY_LED 0xff
|
||||||
|
|
||||||
|
|
||||||
/** Description buttons definition */
|
/** Description buttons definition */
|
||||||
#define BUTTON_S1 PORTA_PIN(7)
|
#define BUTTON_Sn(n) (PORTx_PIN(boardDescription->io->buttons[n].gpioPort, boardDescription->io->buttons[n].gpioPin))
|
||||||
#define BUTTON_S1_INPUT_GPIO GPIO_PAIN
|
#define BUTTON_Sn_WAKE_SOURCE(n) (1 << ((boardDescription->io->buttons[n].gpioPin) + (8 * (boardDescription->io->buttons[n].gpioPort >> 3))))
|
||||||
#define BUTTON_S1_OUTPUT_GPIO GPIO_PAOUT
|
#define BUTTON_INPUT_GPIO(port) *((volatile int32u *) (GPIO_PxIN_BASE + GPIO_Px_OFFSET * port))
|
||||||
#define BUTTON_S1_GPIO_PIN PA7_BIT
|
#define DUMMY_BUTTON 0xff
|
||||||
#define BUTTON_S1_WAKE_SOURCE 0x00000080
|
|
||||||
|
#define BUTTON_S1 (boardDescription->buttons>0 ? BUTTON_Sn(0): DUMMY_BUTTON)
|
||||||
|
#define BUTTON_S2 (boardDescription->buttons>1 ? BUTTON_Sn(1): DUMMY_BUTTON)
|
||||||
|
#define BUTTON_S3 (boardDescription->buttons>2 ? BUTTON_Sn(2): DUMMY_BUTTON)
|
||||||
|
#define BUTTON_S4 (boardDescription->buttons>3 ? BUTTON_Sn(3): DUMMY_BUTTON)
|
||||||
|
#define BUTTON_S5 (boardDescription->buttons>4 ? BUTTON_Sn(4): DUMMY_BUTTON)
|
||||||
|
|
||||||
|
#define BUTTON_S1_WAKE_SOURCE (boardDescription->buttons>0 ? BUTTON_Sn_WAKE_SOURCE(0): 0)
|
||||||
|
#define BUTTON_S2_WAKE_SOURCE (boardDescription->buttons>1 ? BUTTON_Sn_WAKE_SOURCE(1): 0)
|
||||||
|
#define BUTTON_S3_WAKE_SOURCE (boardDescription->buttons>2 ? BUTTON_Sn_WAKE_SOURCE(2): 0)
|
||||||
|
#define BUTTON_S4_WAKE_SOURCE (boardDescription->buttons>3 ? BUTTON_Sn_WAKE_SOURCE(3): 0)
|
||||||
|
#define BUTTON_S5_WAKE_SOURCE (boardDescription->buttons>4 ? BUTTON_Sn_WAKE_SOURCE(4): 0)
|
||||||
|
|
||||||
/** Description uart definition */
|
/** Description uart definition */
|
||||||
#define UART_TX PORTB_PIN(1)
|
#define UART_TX PORTB_PIN(1)
|
||||||
|
@ -26,8 +223,37 @@
|
||||||
#define UART_RX_WAKE_SOURCE 0x00000400
|
#define UART_RX_WAKE_SOURCE 0x00000400
|
||||||
|
|
||||||
/** Description temperature sensor GPIO */
|
/** Description temperature sensor GPIO */
|
||||||
#define TEMPERATURE_SENSOR_GPIO PORTB_PIN(7)
|
#define TEMPERATURE_SENSOR_GPIO PORTx_PIN(boardDescription->temperatureSensor->gpioPort, boardDescription->temperatureSensor->gpioPin) // PORTB_PIN(7)
|
||||||
#endif /* BOARD_MB851 */
|
|
||||||
|
/** @brief Return pointer to board description structure
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return Pointer to board description structure
|
||||||
|
*/
|
||||||
|
BoardResourcesType const *halBoardGetDescription(void);
|
||||||
|
/**
|
||||||
|
* @brief Initialize the board description data structure after
|
||||||
|
* autodetect of the boards based on the CIB Board name field
|
||||||
|
* content. In case of invalid CIB data it will default to MB851A.
|
||||||
|
* Customer normally needs to modify this file to adapt it to their specific board.
|
||||||
|
*/
|
||||||
|
void halBoardInit(void);
|
||||||
|
/**
|
||||||
|
* @brief Perform board specific action to power up the system.
|
||||||
|
* This code depends on the actual board features and configure
|
||||||
|
* the stm32w and on board devices for proper operation.
|
||||||
|
* Customer normally needs to modify this file to adapt it to their specific board.
|
||||||
|
*/
|
||||||
|
void halBoardPowerUp(void);
|
||||||
|
/**
|
||||||
|
* @brief Perform board specific action to power down the system, usually before going to deep sleep.
|
||||||
|
* This code depends on the actual board features and configure
|
||||||
|
* the stm32w and on board devices for minimal power consumption.
|
||||||
|
* Customer normally needs to modify this file to adapt it to their specific board.
|
||||||
|
*/
|
||||||
|
void halBoardPowerDown(void);
|
||||||
|
|
||||||
#endif /* _BOARD_H_ */
|
#endif /* _BOARD_H_ */
|
||||||
|
|
||||||
|
/** @} // END addtogroup
|
||||||
|
*/
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#define RESERVED 0
|
#define RESERVED 0
|
||||||
//#define DUMMY_MALLOC
|
#define IAP_BOOTLOADER_APP_SWITCH_SIGNATURE 0xb001204d
|
||||||
|
#define IAP_BOOTLOADER_MODE_UART 0
|
||||||
/* Includes ----------------------------------------------------------------------*/
|
/* Includes ----------------------------------------------------------------------*/
|
||||||
#include PLATFORM_HEADER
|
#include PLATFORM_HEADER
|
||||||
void NMI_Handler(void);
|
void NMI_Handler(void);
|
||||||
|
@ -72,7 +72,7 @@ VAR_AT_SEGMENT(const HalFixedAddressTableType halFixedAddressTable, __FAT__);
|
||||||
/* function prototypes ------------------------------------------------------*/
|
/* function prototypes ------------------------------------------------------*/
|
||||||
void Reset_Handler(void) __attribute__((__interrupt__));
|
void Reset_Handler(void) __attribute__((__interrupt__));
|
||||||
extern int main(void);
|
extern int main(void);
|
||||||
|
extern void halInternalSwitchToXtal(void);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -121,6 +121,20 @@ void (* const g_pfnVectors[])(void) =
|
||||||
halDebugIsr, // 32
|
halDebugIsr, // 32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void setStackPointer(int32u address) __attribute__((noinline));
|
||||||
|
static void setStackPointer(int32u address)
|
||||||
|
{
|
||||||
|
// This code is needed to generate the instruction below
|
||||||
|
// that GNU ASM is refusing to add
|
||||||
|
// asm("MOVS SP, r0");
|
||||||
|
asm(".short 0x4685");
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int16u blOffset[] = {
|
||||||
|
0x0715 - 0x03ad - 0x68,
|
||||||
|
0x0719 - 0x03ad - 0x6C
|
||||||
|
};
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Function Name : Reset_Handler
|
* Function Name : Reset_Handler
|
||||||
* Description : This is the code that gets called when the processor first starts execution
|
* Description : This is the code that gets called when the processor first starts execution
|
||||||
|
@ -244,6 +258,21 @@ void Reset_Handler(void)
|
||||||
while(1) { ; }
|
while(1) { ; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//USART bootloader software activation check
|
||||||
|
if ((*((int32u *)RAM_BOTTOM) == IAP_BOOTLOADER_APP_SWITCH_SIGNATURE) && (*((int8u *)(RAM_BOTTOM+4)) == IAP_BOOTLOADER_MODE_UART)){
|
||||||
|
int8u cut = *(volatile int8u *) 0x08040798;
|
||||||
|
int16u offset = 0;
|
||||||
|
typedef void (*EntryPoint)(void);
|
||||||
|
offset = (halFixedAddressTable.baseTable.version == 3) ? blOffset[cut - 2] : 0;
|
||||||
|
*((int32u *)RAM_BOTTOM) = 0;
|
||||||
|
if (offset) {
|
||||||
|
halInternalSwitchToXtal();
|
||||||
|
}
|
||||||
|
EntryPoint entryPoint = (EntryPoint)(*(int32u *)(FIB_BOTTOM+4) - offset);
|
||||||
|
setStackPointer(*(int32u *)FIB_BOTTOM);
|
||||||
|
entryPoint();
|
||||||
|
}
|
||||||
|
|
||||||
INTERRUPTS_OFF();
|
INTERRUPTS_OFF();
|
||||||
asm("CPSIE i");
|
asm("CPSIE i");
|
||||||
|
|
||||||
|
@ -302,12 +331,10 @@ caddr_t _sbrk ( int incr )
|
||||||
return (caddr_t) prev_heap;
|
return (caddr_t) prev_heap;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# ifdef DUMMY_MALLOC
|
|
||||||
caddr_t _sbrk ( int incr )
|
caddr_t _sbrk ( int incr )
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
int _lseek (int file,
|
int _lseek (int file,
|
||||||
int ptr,
|
int ptr,
|
||||||
|
|
|
@ -13,71 +13,65 @@ GROUP(
|
||||||
These are used by the startup in order to allocate stacks for the different modes.
|
These are used by the startup in order to allocate stacks for the different modes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__Stack_Size = 0x500 ;
|
__Stack_Size = 0x400 ;
|
||||||
|
|
||||||
PROVIDE ( _Stack_Size = __Stack_Size ) ;
|
PROVIDE ( _Stack_Size = __Stack_Size ) ;
|
||||||
|
|
||||||
__Stack_Init = _estack - __Stack_Size ;
|
__Stack_Init = 0x20000000;
|
||||||
|
|
||||||
|
_estack = __Stack_Init + __Stack_Size;
|
||||||
|
|
||||||
|
|
||||||
/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
|
/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
|
||||||
PROVIDE ( _Stack_Init = __Stack_Init ) ;
|
PROVIDE ( _Stack_Init = __Stack_Init ) ;
|
||||||
|
|
||||||
/*
|
|
||||||
There will be a link error if there is not this amount of RAM free at the end.
|
|
||||||
*/
|
|
||||||
_Minimum_Stack_Size = 0x500 ;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this sends all unreferenced IRQHandlers to reset
|
this sends all unreferenced IRQHandlers to reset
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PROVIDE(Default_Handler = 0 );
|
PROVIDE(NMI_Handler = 0 );
|
||||||
PROVIDE(NMI_Handler = Default_Handler );
|
PROVIDE(HardFault_Handler = 0 );
|
||||||
PROVIDE(HardFault_Handler = Default_Handler );
|
PROVIDE(MemManage_Handler = 0 );
|
||||||
PROVIDE(MemManage_Handler = Default_Handler );
|
PROVIDE(BusFault_Handler = 0 );
|
||||||
PROVIDE(BusFault_Handler = Default_Handler );
|
PROVIDE(UsageFault_Handler = 0 );
|
||||||
PROVIDE(UsageFault_Handler = Default_Handler );
|
PROVIDE(SVC_Handler = 0 );
|
||||||
PROVIDE(SVC_Handler = Default_Handler );
|
PROVIDE(DebugMonitor_Handler = 0 );
|
||||||
PROVIDE(DebugMonitor_Handler = Default_Handler );
|
PROVIDE(PendSV_Handler = 0 );
|
||||||
PROVIDE(PendSV_Handler = Default_Handler );
|
PROVIDE(SysTick_Handler = 0 );
|
||||||
PROVIDE(SysTick_Handler = Default_Handler );
|
PROVIDE(halTimer1Isr = 0 );
|
||||||
PROVIDE(halTimer1Isr = Default_Handler );
|
PROVIDE(halTimer2Isr = 0 );
|
||||||
PROVIDE(halTimer2Isr = Default_Handler );
|
PROVIDE(halManagementIsr = 0 );
|
||||||
PROVIDE(halManagementIsr = Default_Handler );
|
PROVIDE(halBaseBandIsr = 0 );
|
||||||
PROVIDE(halBaseBandIsr = Default_Handler );
|
PROVIDE(halSleepTimerIsr = 0 );
|
||||||
PROVIDE(halSleepTimerIsr = Default_Handler );
|
PROVIDE(halSc1Isr = 0 );
|
||||||
PROVIDE(halSc1Isr = Default_Handler );
|
PROVIDE(halSc2Isr = 0 );
|
||||||
PROVIDE(halSc2Isr = Default_Handler );
|
PROVIDE(halSecurityIsr = 0 );
|
||||||
PROVIDE(halSecurityIsr = Default_Handler );
|
PROVIDE(halStackMacTimerIsr = 0 );
|
||||||
PROVIDE(halStackMacTimerIsr = Default_Handler );
|
PROVIDE(stmRadioTransmitIsr = 0 );
|
||||||
PROVIDE(stmRadioTransmitIsr = Default_Handler );
|
PROVIDE(stmRadioReceiveIsr = 0 );
|
||||||
PROVIDE(stmRadioReceiveIsr = Default_Handler );
|
PROVIDE(halAdcIsr = 0 );
|
||||||
PROVIDE(halAdcIsr = Default_Handler );
|
PROVIDE(halIrqAIsr = 0 );
|
||||||
PROVIDE(halIrqAIsr = Default_Handler );
|
PROVIDE(halIrqBIsr = 0 );
|
||||||
PROVIDE(halIrqBIsr = Default_Handler );
|
PROVIDE(halIrqCIsr = 0 );
|
||||||
PROVIDE(halIrqCIsr = Default_Handler );
|
PROVIDE(halIrqDIsr = 0 );
|
||||||
PROVIDE(halIrqDIsr = Default_Handler );
|
PROVIDE(halDebugIsr = 0 );
|
||||||
PROVIDE(halDebugIsr = Default_Handler );
|
|
||||||
/*PROVIDE(stSerialPrintf = printf );*/
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* Peripheral memory map */
|
/* Peripheral memory map */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/*this allows to compile the ST lib in "non-debug" mode*/
|
/*this allows to compile the ST lib in "non-debug" mode*/
|
||||||
|
_BOOTLOADER_SIZE = 0x3000 ;
|
||||||
|
_ROM_base = DEFINED(ST_BTL) ? (0x08000000 + _BOOTLOADER_SIZE) : 0x08000000 ;
|
||||||
/* include the memory spaces definitions sub-script */
|
/* include the memory spaces definitions sub-script */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
RAM_region (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
|
RAM_region (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
|
||||||
ROM_region (rx) : ORIGIN = 0x08000000, LENGTH = 128K-3K
|
ROM_region (rx) : ORIGIN = 0x08000000, LENGTH = 128K-2K
|
||||||
NVM_region (rx) : ORIGIN = 0x0801F400, LENGTH = 3K
|
NVM_region (rx) : ORIGIN = 0x0801F800, LENGTH = 2K
|
||||||
FIB_region (ra) : ORIGIN = 0x08040000, LENGTH = 2K
|
FIB_region (ra) : ORIGIN = 0x08040000, LENGTH = 2K
|
||||||
}
|
}
|
||||||
|
|
||||||
/* higher address of the user mode stack */
|
|
||||||
_estack = 0x20002000;
|
|
||||||
|
|
||||||
/* Sections management for FLASH mode */
|
/* Sections management for FLASH mode */
|
||||||
|
|
||||||
|
@ -87,9 +81,12 @@ SECTIONS
|
||||||
{
|
{
|
||||||
|
|
||||||
/* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
|
/* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
|
||||||
.isr_vector :
|
|
||||||
|
.isr_vector (DEFINED(ST_BTL) ? (0x08000000 + _BOOTLOADER_SIZE) : 0x08000000) :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
|
__ApplicationFlashStart = . ;
|
||||||
|
/* . = . + _ROM_base ;*/
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
KEEP(*(.isr_vector)) /* Startup code */
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >ROM_region
|
} >ROM_region
|
||||||
|
@ -113,24 +110,12 @@ SECTIONS
|
||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
*(.glue_7)
|
*(.glue_7)
|
||||||
*(.glue_7t)
|
*(.glue_7t)
|
||||||
. = ALIGN(1024);
|
|
||||||
*(.elf_text)
|
. = ALIGN(4);
|
||||||
. = ALIGN(1024);
|
|
||||||
/*. = ALIGN(4);*/
|
|
||||||
_etext = .;
|
_etext = .;
|
||||||
/* This is used by the startup in order to initialize the .data section */
|
/* This is used by the startup in order to initialize the .data secion */
|
||||||
_sidata = _etext;
|
_sidata = _etext;
|
||||||
} >ROM_region
|
} >ROM_region
|
||||||
|
|
||||||
.coffee 0x08010000 :
|
|
||||||
{
|
|
||||||
_coffee_start = ABSOLUTE(.);
|
|
||||||
. = ALIGN(1024);
|
|
||||||
*(.coffeefiles)
|
|
||||||
. = ORIGIN(NVM_region) - _coffee_start;
|
|
||||||
} > ROM_region = 0x00
|
|
||||||
|
|
||||||
|
|
||||||
NVM (NOLOAD):
|
NVM (NOLOAD):
|
||||||
{
|
{
|
||||||
. = ALIGN(1024);
|
. = ALIGN(1024);
|
||||||
|
@ -146,6 +131,12 @@ SECTIONS
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} > FIB_region
|
} > FIB_region
|
||||||
|
|
||||||
|
/*
|
||||||
|
.FAT (NOLOAD):
|
||||||
|
{
|
||||||
|
KEEP(*(.FAT))
|
||||||
|
} > FIB_region
|
||||||
|
*/
|
||||||
/* after that it's only debugging information. */
|
/* after that it's only debugging information. */
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,10 +144,10 @@ SECTIONS
|
||||||
The program executes knowing that the data is in the RAM
|
The program executes knowing that the data is in the RAM
|
||||||
but the loader puts the initial values in the FLASH (inidata).
|
but the loader puts the initial values in the FLASH (inidata).
|
||||||
It is one task of the startup to copy the initial values from FLASH to RAM. */
|
It is one task of the startup to copy the initial values from FLASH to RAM. */
|
||||||
.data : AT ( _sidata )
|
.data _estack : AT ( _sidata )
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
/* This is used by the startup in order to initialize the .data section */
|
/* This is used by the startup in order to initialize the .data secion */
|
||||||
_sdata = . ;
|
_sdata = . ;
|
||||||
|
|
||||||
*(.data)
|
*(.data)
|
||||||
|
@ -165,10 +156,10 @@ SECTIONS
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
/* This is used by the startup in order to initialize the .data secion */
|
/* This is used by the startup in order to initialize the .data secion */
|
||||||
_edata = . ;
|
_edata = . ;
|
||||||
ASSERT(_sidata + SIZEOF(.data) < LOADADDR(.coffee), ".data section overflow in ROM");
|
|
||||||
} >RAM_region
|
} >RAM_region
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* This is the uninitialized data section */
|
/* This is the uninitialized data section */
|
||||||
.bss :
|
.bss :
|
||||||
{
|
{
|
||||||
|
@ -177,6 +168,7 @@ SECTIONS
|
||||||
_sbss = .;
|
_sbss = .;
|
||||||
|
|
||||||
*(.bss)
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
|
@ -187,21 +179,6 @@ SECTIONS
|
||||||
PROVIDE ( end = _ebss );
|
PROVIDE ( end = _ebss );
|
||||||
PROVIDE ( _end = _ebss );
|
PROVIDE ( _end = _ebss );
|
||||||
|
|
||||||
/* This is the user stack section
|
|
||||||
This is just to check that there is enough RAM left for the User mode stack
|
|
||||||
It should generate an error if it's full.
|
|
||||||
*/
|
|
||||||
._usrstack :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
_susrstack = . ;
|
|
||||||
|
|
||||||
. = . + _Minimum_Stack_Size ;
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_eusrstack = . ;
|
|
||||||
} >RAM_region
|
|
||||||
|
|
||||||
__exidx_start = .;
|
__exidx_start = .;
|
||||||
__exidx_end = .;
|
__exidx_end = .;
|
||||||
|
|
||||||
|
@ -247,3 +224,5 @@ SECTIONS
|
||||||
.debug_typenames 0 : { *(.debug_typenames) }
|
.debug_typenames 0 : { *(.debug_typenames) }
|
||||||
.debug_varnames 0 : { *(.debug_varnames) }
|
.debug_varnames 0 : { *(.debug_varnames) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__ApplicationFlashEnd = _sidata + (_edata - _sdata);
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
|
|
||||||
|
if( isdefinedsymbol(ST_BTL) ) {
|
||||||
|
define symbol __ICFEDIT_intvec_start__ = 0x08003000;
|
||||||
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08003000;
|
||||||
|
} else {
|
||||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||||
/*-Memory Regions-*/
|
|
||||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-Memory Regions-*/
|
||||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
|
define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
|
||||||
define symbol __ICFEDIT_region_FIB_start__ = 0x08040000;
|
define symbol __ICFEDIT_region_FIB_start__ = 0x08040000;
|
||||||
define symbol __ICFEDIT_region_FIB_end__ = 0x080407FF;
|
define symbol __ICFEDIT_region_FIB_end__ = 0x080407FF;
|
||||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
|
define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
|
||||||
/*-Sizes-*/
|
/*-Sizes-*/
|
||||||
define symbol __ICFEDIT_size_cstack__ = 0x500;
|
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
define memory mem with size = 4G;
|
define memory mem with size = 4G;
|
||||||
|
@ -15,16 +23,17 @@ define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFED
|
||||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||||
|
|
||||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||||
|
define block FLASH_IMAGE with fixed order { readonly section .intvec, readonly } ;
|
||||||
|
|
||||||
initialize by copy { readwrite };
|
initialize by copy { readwrite };
|
||||||
do not initialize { section .noinit,
|
do not initialize { section .noinit,
|
||||||
section FAT,
|
section FAT,
|
||||||
section NVM };
|
section NVM };
|
||||||
|
|
||||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
|
||||||
|
|
||||||
place at address mem:__ICFEDIT_region_FIB_start__ { section FAT };
|
place at address mem:__ICFEDIT_region_FIB_start__ { section FAT };
|
||||||
place in ROM_region { readonly };
|
place in ROM_region { block FLASH_IMAGE };
|
||||||
|
|
||||||
place at end of ROM_region { section NVM };
|
place at end of ROM_region { section NVM };
|
||||||
place in RAM_region { readwrite,
|
place in RAM_region { readwrite,
|
||||||
block CSTACK };
|
block CSTACK };
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,24 @@ extern "C" {
|
||||||
__root __no_init const HalFixedAddressTableType halFixedAddressTable @ __FAT__;
|
__root __no_init const HalFixedAddressTableType halFixedAddressTable @ __FAT__;
|
||||||
|
|
||||||
extern const HalVectorTableType __vector_table[];
|
extern const HalVectorTableType __vector_table[];
|
||||||
|
extern void halInternalSwitchToXtal(void);
|
||||||
|
|
||||||
|
#define IAP_BOOTLOADER_APP_SWITCH_SIGNATURE 0xb001204d
|
||||||
|
#define IAP_BOOTLOADER_MODE_UART 0
|
||||||
|
|
||||||
__interwork int __low_level_init(void);
|
__interwork int __low_level_init(void);
|
||||||
|
|
||||||
|
static void setStackPointer(int32u address)
|
||||||
|
{
|
||||||
|
asm("MOVS SP, r0");
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int16u blOffset[] = {
|
||||||
|
0x0715 - 0x03ad - 0x68,
|
||||||
|
0x0719 - 0x03ad - 0x6C
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
__interwork int __low_level_init(void)
|
__interwork int __low_level_init(void)
|
||||||
{
|
{
|
||||||
//Ensure there is enough margin on VREG_1V8 for stable RAM reads by
|
//Ensure there is enough margin on VREG_1V8 for stable RAM reads by
|
||||||
|
@ -154,6 +168,21 @@ __interwork int __low_level_init(void)
|
||||||
while(1) { ; }
|
while(1) { ; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//USART bootloader software activation check
|
||||||
|
if ((*((int32u *)RAM_BOTTOM) == IAP_BOOTLOADER_APP_SWITCH_SIGNATURE) && (*((int8u *)(RAM_BOTTOM+4)) == IAP_BOOTLOADER_MODE_UART)){
|
||||||
|
int8u cut = *(volatile int8u *) 0x08040798;
|
||||||
|
int16u offset = 0;
|
||||||
|
typedef void (*EntryPoint)(void);
|
||||||
|
offset = (halFixedAddressTable.baseTable.version == 3) ? blOffset[cut - 2] : 0;
|
||||||
|
*((int32u *)RAM_BOTTOM) = 0;
|
||||||
|
if (offset) {
|
||||||
|
halInternalSwitchToXtal();
|
||||||
|
}
|
||||||
|
EntryPoint entryPoint = (EntryPoint)(*(int32u *)(FIB_BOTTOM+4) - offset);
|
||||||
|
setStackPointer(*(int32u *)FIB_BOTTOM);
|
||||||
|
entryPoint();
|
||||||
|
}
|
||||||
|
|
||||||
INTERRUPTS_OFF();
|
INTERRUPTS_OFF();
|
||||||
asm("CPSIE i");
|
asm("CPSIE i");
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#define __REGS_H__ 1
|
#define __REGS_H__ 1
|
||||||
|
|
||||||
|
|
||||||
|
#define ReadRegister(a) a
|
||||||
|
#define WriteRegister(a, b) a = b
|
||||||
|
|
||||||
/* FLASH_BASE block */
|
/* FLASH_BASE block */
|
||||||
#define DATA_FLASH_BASE_BASE (0x00000000u)
|
#define DATA_FLASH_BASE_BASE (0x00000000u)
|
||||||
#define DATA_FLASH_BASE_END (0x0001FFFFu)
|
#define DATA_FLASH_BASE_END (0x0001FFFFu)
|
||||||
|
|
|
@ -29,7 +29,7 @@ void temperatureSensor_Init(void)
|
||||||
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
||||||
}/* end temperatureSensor_Init() */
|
}/* end temperatureSensor_Init() */
|
||||||
|
|
||||||
int32u temperatureSensor_GetValue(int8u type)
|
int32u temperatureSensor_GetValue(void)
|
||||||
{
|
{
|
||||||
static int16u ADCvalue;
|
static int16u ADCvalue;
|
||||||
static int16s volts;
|
static int16s volts;
|
||||||
|
@ -40,7 +40,6 @@ int32u temperatureSensor_GetValue(int8u type)
|
||||||
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
(see STM32W108 errata). As consequence, it is not reccomended to use this ADC driver for getting
|
||||||
the temperature values.
|
the temperature values.
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLE_ADC_EXTENDED_RANGE_BROKEN
|
|
||||||
halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE_ADC2_VREF2, ADC_CONVERSION_TIME_US_4096);
|
halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE_ADC2_VREF2, ADC_CONVERSION_TIME_US_4096);
|
||||||
|
|
||||||
halReadAdcBlocking(ADC_USER_APP, &ADCvalue); // This blocks for a while, about 4ms.
|
halReadAdcBlocking(ADC_USER_APP, &ADCvalue); // This blocks for a while, about 4ms.
|
||||||
|
@ -49,6 +48,5 @@ int32u temperatureSensor_GetValue(int8u type)
|
||||||
volts = halConvertValueToVolts(ADCvalue);
|
volts = halConvertValueToVolts(ADCvalue);
|
||||||
|
|
||||||
return ((18641 - (int32s)volts)*100)/1171;
|
return ((18641 - (int32s)volts)*100)/1171;
|
||||||
#endif /* ENABLE_ADC_EXTENDED_RANGE_BROKEN */
|
|
||||||
}/* end temperatureSensor_GetValue() */
|
}/* end temperatureSensor_GetValue() */
|
||||||
|
|
||||||
|
|
|
@ -135,18 +135,6 @@
|
||||||
int8s halCommonMemCompare(const void *source0, const void *source1, int8u bytes);
|
int8s halCommonMemCompare(const void *source0, const void *source1, int8u bytes);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Works like C stdlib memcmp(), but takes a flash space source
|
|
||||||
* parameter.
|
|
||||||
*/
|
|
||||||
int8s halCommonMemPGMCompare(const void *source0, void PGM *source1, int8u bytes);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Same as the C stdlib memcpy(), but handles copying from const
|
|
||||||
* program space.
|
|
||||||
*/
|
|
||||||
void halCommonMemPGMCopy(void* dest, void PGM *source, int8u bytes);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Friendly convenience macro pointing to the full HAL function.
|
* @brief Friendly convenience macro pointing to the full HAL function.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -49,16 +49,9 @@ void halSetLed(HalBoardLed led);
|
||||||
*/
|
*/
|
||||||
void halClearLed(HalBoardLed led);
|
void halClearLed(HalBoardLed led);
|
||||||
|
|
||||||
/** @brief Called by the stack to indicate activity over the radio (for
|
#ifdef CORTEXM3_STM32F103
|
||||||
* both transmission and reception). It is called once with \c turnOn TRUE and
|
#include "micro/cortexm3/stm32f103ret/led-specific.h"
|
||||||
* shortly thereafter with \c turnOn FALSE.
|
#endif
|
||||||
*
|
|
||||||
* Typically does something interesting, such as change the state of
|
|
||||||
* an LED.
|
|
||||||
*
|
|
||||||
* @param turnOn See Usage.
|
|
||||||
*/
|
|
||||||
void halStackIndicateActivity(boolean turnOn);
|
|
||||||
|
|
||||||
/** @} // END addtogroup
|
/** @} // END addtogroup
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,6 +15,15 @@
|
||||||
#ifndef __MICRO_COMMON_H__
|
#ifndef __MICRO_COMMON_H__
|
||||||
#define __MICRO_COMMON_H__
|
#define __MICRO_COMMON_H__
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
#ifndef __STSTATUS_TYPE__
|
||||||
|
#define __STSTATUS_TYPE__
|
||||||
|
//This is necessary here because halSleepForQsWithOptions returns an
|
||||||
|
//StStatus and not adding this typedef to this file breaks a
|
||||||
|
//whole lot of builds.
|
||||||
|
typedef int8u StStatus;
|
||||||
|
#endif //__STSTATUS_TYPE__
|
||||||
|
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
/** @brief Initializes microcontroller-specific peripherals.
|
/** @brief Initializes microcontroller-specific peripherals.
|
||||||
*/
|
*/
|
||||||
|
@ -109,6 +118,28 @@ enum
|
||||||
*/
|
*/
|
||||||
void halCommonDelayMicroseconds(int16u us);
|
void halCommonDelayMicroseconds(int16u us);
|
||||||
|
|
||||||
|
/** @brief Request the appplication to enter in bootloader mode
|
||||||
|
*
|
||||||
|
* This function will check whwther the user flash contains the bootloader
|
||||||
|
* and if yes it will jump into it according to the user parameters.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param mode The bootloader mode, 0 UART mode, 1 RF mode. All other
|
||||||
|
* values are reserved
|
||||||
|
* @param channel The channel where the booloader will operate. 0 means
|
||||||
|
* default channel (only vaild for RF mode).
|
||||||
|
* @param panID The panID where the booloader will operate. 0xFFFF means
|
||||||
|
* default panID (only vaild for RF mode).
|
||||||
|
* @return An error code or it will never return.
|
||||||
|
*/
|
||||||
|
StStatus halBootloaderStart(int8u mode, int8u channel, int16u panId);
|
||||||
|
|
||||||
|
#ifdef CORTEXM3_STM32F103
|
||||||
|
#include "micro/cortexm3/stm32f103ret/micro-specific.h"
|
||||||
|
#endif
|
||||||
|
#ifdef CORTEXM3_STM32W108
|
||||||
|
#include "micro/cortexm3/micro-common.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //__MICRO_COMMON_H__
|
#endif //__MICRO_COMMON_H__
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,9 @@ int16u halInternalStartSystemTimer(void);
|
||||||
* @return The least significant 16 bits of the current system time, in system
|
* @return The least significant 16 bits of the current system time, in system
|
||||||
* ticks.
|
* ticks.
|
||||||
*/
|
*/
|
||||||
//#pragma pagezero_on // place this function in zero-page memory for xap
|
#pragma pagezero_on // place this function in zero-page memory for xap
|
||||||
int16u halCommonGetInt16uMillisecondTick(void);
|
int16u halCommonGetInt16uMillisecondTick(void);
|
||||||
//#pragma pagezero_off
|
#pragma pagezero_off
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the current system time in system ticks, as a 32-bit
|
* @brief Returns the current system time in system ticks, as a 32-bit
|
||||||
|
|
|
@ -21,7 +21,7 @@ void temperatureSensor_Init(void);
|
||||||
|
|
||||||
/** @brief Get temperature sensor value
|
/** @brief Get temperature sensor value
|
||||||
*/
|
*/
|
||||||
int32u temperatureSensor_GetValue(int8u type);
|
int32u temperatureSensor_GetValue(void);
|
||||||
|
|
||||||
#endif /* _TEMP_SENSOR_H_ */
|
#endif /* _TEMP_SENSOR_H_ */
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
|
|
||||||
|
if( isdefinedsymbol(ST_BTL) ) {
|
||||||
|
define symbol __ICFEDIT_intvec_start__ = 0x08003000;
|
||||||
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08003000;
|
||||||
|
} else {
|
||||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||||
/*-Memory Regions-*/
|
|
||||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
||||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
|
}
|
||||||
define symbol __ICFEDIT_region_CFS_start__ = 0x08010000; /* Reserved for contiki flash file system. COFFEE_ADDRESS must be changed also in cfs-coffee-arch.h */
|
|
||||||
|
/*-Memory Regions-*/
|
||||||
|
define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
|
||||||
|
define symbol __ICFEDIT_region_CFS_start__ = 0x08010c00; /* Reserved for contiki flash file system. COFFEE_ADDRESS must be changed also in cfs-coffee-arch.h */
|
||||||
define symbol __ICFEDIT_region_CFS_end__ = 0x0801F3FF;
|
define symbol __ICFEDIT_region_CFS_end__ = 0x0801F3FF;
|
||||||
define symbol __ICFEDIT_region_NVM_start__ = 0x0801F400;
|
define symbol __ICFEDIT_region_NVM_start__ = 0x0801F800;
|
||||||
define symbol __ICFEDIT_region_NVM_end__ = 0x0801FFFF;
|
define symbol __ICFEDIT_region_NVM_end__ = 0x0801FFFF;
|
||||||
define symbol __ICFEDIT_region_FIB_start__ = 0x08040000;
|
define symbol __ICFEDIT_region_FIB_start__ = 0x08040000;
|
||||||
define symbol __ICFEDIT_region_FIB_end__ = 0x080407FF;
|
define symbol __ICFEDIT_region_FIB_end__ = 0x080407FF;
|
||||||
|
@ -14,6 +21,7 @@ define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
|
||||||
define symbol __ICFEDIT_size_cstack__ = 0x500;
|
define symbol __ICFEDIT_size_cstack__ = 0x500;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
define memory mem with size = 4G;
|
define memory mem with size = 4G;
|
||||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||||
define region CFS_region = mem:[from __ICFEDIT_region_CFS_start__ to __ICFEDIT_region_CFS_end__];
|
define region CFS_region = mem:[from __ICFEDIT_region_CFS_start__ to __ICFEDIT_region_CFS_end__];
|
||||||
|
@ -21,17 +29,17 @@ define region NVM_region = mem:[from __ICFEDIT_region_NVM_start__ to __ICFED
|
||||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||||
|
|
||||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||||
|
define block FLASH_IMAGE with fixed order { readonly section .intvec, readonly } ;
|
||||||
|
|
||||||
initialize by copy { readwrite };
|
initialize by copy { readwrite };
|
||||||
do not initialize { section .noinit,
|
do not initialize { section .noinit,
|
||||||
section FAT,
|
section FAT,
|
||||||
section NVM };
|
section NVM };
|
||||||
|
|
||||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
|
||||||
|
|
||||||
place at address mem:__ICFEDIT_region_FIB_start__ { section FAT };
|
place at address mem:__ICFEDIT_region_FIB_start__ { section FAT };
|
||||||
place in ROM_region { readonly };
|
place in ROM_region { block FLASH_IMAGE };
|
||||||
place in CFS_region { section .coffeefiles };
|
place in CFS_region { section .coffeefiles };
|
||||||
place in NVM_region { section NVM };
|
place in NVM_region { section NVM };
|
||||||
place in RAM_region { readwrite,
|
place in RAM_region { readwrite,
|
||||||
block CSTACK };
|
block CSTACK };
|
||||||
|
|
39
cpu/stm32w108/iar-cfg.icf
Normal file
39
cpu/stm32w108/iar-cfg.icf
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
if( isdefinedsymbol(ST_BTL) ) {
|
||||||
|
define symbol __ICFEDIT_intvec_start__ = 0x08003000;
|
||||||
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08003000;
|
||||||
|
} else {
|
||||||
|
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||||
|
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-Memory Regions-*/
|
||||||
|
define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
|
||||||
|
define symbol __ICFEDIT_region_FIB_start__ = 0x08040000;
|
||||||
|
define symbol __ICFEDIT_region_FIB_end__ = 0x080407FF;
|
||||||
|
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||||
|
define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
|
||||||
|
/*-Sizes-*/
|
||||||
|
define symbol __ICFEDIT_size_cstack__ = 0x500;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define memory mem with size = 4G;
|
||||||
|
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||||
|
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||||
|
|
||||||
|
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||||
|
define block FLASH_IMAGE with fixed order { readonly section .intvec, readonly } ;
|
||||||
|
|
||||||
|
initialize by copy { readwrite };
|
||||||
|
do not initialize { section .noinit,
|
||||||
|
section FAT,
|
||||||
|
section NVM };
|
||||||
|
|
||||||
|
place at address mem:__ICFEDIT_region_FIB_start__ { section FAT };
|
||||||
|
place in ROM_region { block FLASH_IMAGE };
|
||||||
|
|
||||||
|
place at end of ROM_region { section NVM };
|
||||||
|
place in RAM_region { readwrite,
|
||||||
|
block CSTACK };
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stm32w108_type.h"
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Definitions
|
// Definitions
|
||||||
|
@ -30,7 +29,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief Version patch number
|
* @brief Version patch number
|
||||||
*/
|
*/
|
||||||
#define SIMPLEMAC_VERSION_PATCH 0
|
#define SIMPLEMAC_VERSION_PATCH 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Version qualifier
|
* @brief Version qualifier
|
||||||
|
|
BIN
cpu/stm32w108/simplemac/library/simplemac-library-gnu.a
Normal file
BIN
cpu/stm32w108/simplemac/library/simplemac-library-gnu.a
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -5,7 +5,7 @@ ARCH= irq.c sensors.c acc-sensor.c button-sensor.c temperature-sensor.c mems.c
|
||||||
|
|
||||||
CONTIKI_TARGET_DIRS = . dev
|
CONTIKI_TARGET_DIRS = . dev
|
||||||
ifndef CONTIKI_TARGET_MAIN
|
ifndef CONTIKI_TARGET_MAIN
|
||||||
CONTIKI_TARGET_MAIN = contiki-main.c #contiki-init-net.c
|
CONTIKI_TARGET_MAIN = contiki-main.c board-mb851.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef UIP_CONF_IPV6
|
ifdef UIP_CONF_IPV6
|
||||||
|
|
47
platform/mb851/board-mb851.c
Normal file
47
platform/mb851/board-mb851.c
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#include PLATFORM_HEADER
|
||||||
|
#include BOARD_HEADER
|
||||||
|
|
||||||
|
void halBoardInit(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void halBoardPowerDown(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void halBoardPowerUp(void)
|
||||||
|
{
|
||||||
|
/* Set everything to input value */
|
||||||
|
GPIO_PACFGL = (GPIOCFG_IN <<PA0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA1_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA2_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA3_CFG_BIT);
|
||||||
|
GPIO_PACFGH = (GPIOCFG_IN <<PA4_CFG_BIT)| /* PTI EN */
|
||||||
|
(GPIOCFG_IN <<PA5_CFG_BIT)| /* PTI_DATA */
|
||||||
|
(GPIOCFG_IN <<PA6_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PA7_CFG_BIT);
|
||||||
|
GPIO_PBCFGL = (GPIOCFG_IN <<PB0_CFG_BIT)|
|
||||||
|
(GPIOCFG_OUT_ALT <<PB1_CFG_BIT)| /* Uart TX */
|
||||||
|
(GPIOCFG_IN <<PB2_CFG_BIT)| /* Uart RX */
|
||||||
|
(GPIOCFG_IN <<PB3_CFG_BIT);
|
||||||
|
GPIO_PBCFGH = (GPIOCFG_IN <<PB4_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB5_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB6_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PB7_CFG_BIT);
|
||||||
|
GPIO_PCCFGL = (GPIOCFG_IN <<PC0_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC1_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC2_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC3_CFG_BIT);
|
||||||
|
GPIO_PCCFGH = (GPIOCFG_IN <<PC4_CFG_BIT)|
|
||||||
|
(GPIOCFG_IN <<PC5_CFG_BIT)|
|
||||||
|
#ifdef EMBERZNET_HAL
|
||||||
|
(CFG_C6 <<PC6_CFG_BIT)| /* OSC32K */
|
||||||
|
(CFG_C7 <<PC7_CFG_BIT); /* OSC32K */
|
||||||
|
#else
|
||||||
|
(GPIOCFG_IN <<PC6_CFG_BIT)| /* OSC32K */
|
||||||
|
(GPIOCFG_IN <<PC7_CFG_BIT); /* OSC32K */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
|
@ -48,6 +48,15 @@
|
||||||
|
|
||||||
#define DEBOUNCE 1
|
#define DEBOUNCE 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Port and pin for BUTTON0.
|
||||||
|
*/
|
||||||
|
#undef BUTTON_S1
|
||||||
|
#define BUTTON_S1 PORTA_PIN(7)
|
||||||
|
#define BUTTON_S1_INPUT_GPIO BUTTON_INPUT_GPIO(PORTA)
|
||||||
|
#define BUTTON_S1_GPIO_PIN 7
|
||||||
|
#define BUTTON_S1_OUTPUT_GPIO GPIO_PAOUT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Point the proper IRQ at the desired pin for BUTTON0.
|
* @brief Point the proper IRQ at the desired pin for BUTTON0.
|
||||||
*/
|
*/
|
||||||
|
@ -88,6 +97,8 @@ init(void)
|
||||||
timer_set(&debouncetimer, 0);
|
timer_set(&debouncetimer, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Configure GPIO for BUTTONSs */
|
||||||
|
|
||||||
//Input, pulled up or down (selected by GPIO_PxOUT: 0 = pull-down, 1 = pull-up).
|
//Input, pulled up or down (selected by GPIO_PxOUT: 0 = pull-down, 1 = pull-up).
|
||||||
halGpioConfig(BUTTON_S1,GPIOCFG_IN_PUD);
|
halGpioConfig(BUTTON_S1,GPIOCFG_IN_PUD);
|
||||||
BUTTON_S1_OUTPUT_GPIO |= GPIOOUT_PULLUP << BUTTON_S1_GPIO_PIN;
|
BUTTON_S1_OUTPUT_GPIO |= GPIOOUT_PULLUP << BUTTON_S1_GPIO_PIN;
|
||||||
|
@ -95,6 +106,7 @@ init(void)
|
||||||
|
|
||||||
BUTTON_S1_SEL();
|
BUTTON_S1_SEL();
|
||||||
BUTTON_S1_INTCFG = 0x40; // Falling edge triggered.
|
BUTTON_S1_INTCFG = 0x40; // Falling edge triggered.
|
||||||
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -56,6 +56,9 @@
|
||||||
|
|
||||||
#include "dev/temperature-sensor.h"
|
#include "dev/temperature-sensor.h"
|
||||||
|
|
||||||
|
#undef TEMPERATURE_SENSOR_GPIO
|
||||||
|
#define TEMPERATURE_SENSOR_GPIO PORTB_PIN(7)
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue