Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,15 @@ apollo_nvic.h
# Apollo2 linker script - MIT License
apollo2.ld

# CMSIS Cortex-M4, STM32f3 - BSD License.
STM32F3xx
STM32F3xx_HAL_Driver

# Nucleo-F303K8, Nucleo-F303RE - BSD License.
system_stm32f3xx.c
startup_stm32f303x8.s
startup_stm32f303xe.s
stm32f3xx_hal_conf.h

# Ignore documentation folder
docs
3 changes: 3 additions & 0 deletions hw/bsp/nucleo-f303k8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Due to the flash size of the board there is currently no bootloader support.
The image created is relocated to the reset address of the flash and is expected
to be programmed with `newt load ...`.
61 changes: 61 additions & 0 deletions hw/bsp/nucleo-f303k8/bsp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

bsp.arch: cortex_m4
bsp.compiler: compiler/arm-none-eabi-m4
bsp.linkerscript:
- "hw/bsp/nucleo-f303k8/nucleo-f303k8.ld"
- "hw/mcu/stm/stm32f3xx/stm32f303.ld"
bsp.downloadscript: "hw/bsp/nucleo-f303k8/nucleo-f303k8_download.sh"
bsp.debugscript: "hw/bsp/nucleo-f303k8/nucleo-f303k8_debug.sh"
bsp.downloadscript.WINDOWS.OVERWRITE: "hw/bsp/nucleo-f303k8/nucleo-f303k8_download.cmd"
bsp.debugscript.WINDOWS.OVERWRITE: "hw/bsp/nucleo-f303k8/nucleo-f303k8_debug.cmd"

bsp.flash_map:
areas:
# System areas.
FLASH_AREA_BOOTLOADER:
device: 0
offset: 0x08100000
size: 0kB
FLASH_AREA_IMAGE_0:
device: 0
offset: 0x08000000
size: 64kB
FLASH_AREA_IMAGE_1:
device: 0
offset: 0x08200000
size: 0kB
FLASH_AREA_IMAGE_SCRATCH:
device: 0
offset: 0x08300000
size: 0kB

# User areas.
FLASH_AREA_REBOOT_LOG:
user_id: 0
device: 0
offset: 0x08400000
size: 0kB
FLASH_AREA_NFFS:
user_id: 1
device: 0
offset: 0x08500000
size: 0kB

75 changes: 75 additions & 0 deletions hw/bsp/nucleo-f303k8/include/bsp/bsp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef H_BSP_H
#define H_BSP_H

#include <inttypes.h>
#include <mcu/mcu.h>
#include <syscfg/syscfg.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Define special stackos sections */
#define sec_data_core __attribute__((section(".data.core")))
#define sec_bss_core __attribute__((section(".bss.core")))
#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))

/* More convenient section placement macros. */
#define bssnz_t sec_bss_nz_core

/*
* Symbols from linker script.
*/
extern uint8_t _sram_start;
extern uint8_t _ccram_start;

#define SRAM_SIZE (12 * 1024)
#define CCRAM_SIZE (4 *1024)

/* LED pins */
#define LED_BLINK_PIN_1 MCU_GPIO_PORTB(3)

#define LED_BLINK_PIN LED_BLINK_PIN_1


/* UART ports */
#if (MYNEWT_VAL(UART_0) && MYNEWT_VAL(UART_1))
# define UART_CNT 2
# define UART_0_DEV_ID 0
# define UART_1_DEV_ID 1
#elif MYNEWT_VAL(UART_0)
# define UART_CNT 1
# define UART_0_DEV_ID 0
#elif MYNEWT_VAL(UART_1)
# define UART_CNT 1
# define UART_1_DEV_ID 0
#else
# define UART_CNT 0
#endif

#define _UART_DEV_NAME(id) ("uart" #id)
#define UART_DEV_NAME(id) _UART_DEV_NAME(id)

#ifdef __cplusplus
}
#endif

#endif /* H_BSP_H */
36 changes: 36 additions & 0 deletions hw/bsp/nucleo-f303k8/include/bsp/bsp_sysid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef BSP_SYSID_H
#define BSP_SYSID_H

#ifdef __cplusplus
extern "C" {
#endif

enum system_device_id
{
NONE = 0,
};

#ifdef __cplusplus
}
#endif

#endif /* BSP_SYSID_H */

48 changes: 48 additions & 0 deletions hw/bsp/nucleo-f303k8/include/bsp/cmsis_nvic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/* mbed Microcontroller Library - cmsis_nvic
* Copyright (c) 2009-2011 ARM Limited. All rights reserved.
*
* CMSIS-style functionality to support dynamic vectors
*/

#ifndef CMSIS_NVIC_H
#define CMSIS_NVIC_H

#include <stdint.h>

#define NVIC_NUM_VECTORS (16 + 81) // CORE + MCU Peripherals
#define NVIC_USER_IRQ_OFFSET 16

#include "stm32f303x8.h"

#ifdef __cplusplus
extern "C" {
#endif

void NVIC_Relocate(void);
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
uint32_t NVIC_GetVector(IRQn_Type IRQn);

#ifdef __cplusplus
}
#endif

#endif
Loading