|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | +#ifndef H_BSP_H |
| 20 | +#define H_BSP_H |
| 21 | + |
| 22 | +#include <inttypes.h> |
| 23 | +#include <mcu/mcu.h> |
| 24 | + |
| 25 | +#ifdef __cplusplus |
| 26 | +extern "C" { |
| 27 | +#endif |
| 28 | + |
| 29 | +/* Define special stackos sections */ |
| 30 | +#define sec_data_core __attribute__((section(".data.core"))) |
| 31 | +#define sec_bss_core __attribute__((section(".bss.core"))) |
| 32 | +#define sec_bss_nz_core __attribute__((section(".bss.core.nz"))) |
| 33 | + |
| 34 | +/* More convenient section placement macros. */ |
| 35 | +#define bssnz_t sec_bss_nz_core |
| 36 | + |
| 37 | +extern uint8_t _ram_start[]; |
| 38 | +extern uint8_t _dtcm_start[]; |
| 39 | +extern uint8_t _itcm_start[]; |
| 40 | + |
| 41 | +#define RAM_SIZE (512 * 1024) |
| 42 | +#define DTCM_SIZE (128 * 1024) |
| 43 | +#define ITCM_SIZE (64 * 1024) |
| 44 | + |
| 45 | +/* LED pins */ |
| 46 | +#define LED_1 MCU_GPIO_PORTB(0) |
| 47 | +#define LED_2 MCU_GPIO_PORTE(1) |
| 48 | +#define LED_3 MCU_GPIO_PORTB(14) |
| 49 | + |
| 50 | +#define LED_green LED_1 |
| 51 | +#define LED_blue LED_2 |
| 52 | +#define LED_red LED_3 |
| 53 | + |
| 54 | +#define LED_BLINK_PIN LED_1 |
| 55 | + |
| 56 | +/* BUTTON pins */ |
| 57 | +#define BTN_USER_1 MCU_GPIO_PORTC(13) |
| 58 | + |
| 59 | +/* Button pin */ |
| 60 | +#define BUTTON_1 BTN_USER_1 |
| 61 | + |
| 62 | +/* Arduino pins */ |
| 63 | +#define ARDUINO_PIN_D0 MCU_GPIO_PORTB(7) |
| 64 | +#define ARDUINO_PIN_D1 MCU_GPIO_PORTB(6) |
| 65 | +#define ARDUINO_PIN_D2 MCU_GPIO_PORTG(14) |
| 66 | +#define ARDUINO_PIN_D3 MCU_GPIO_PORTE(13) |
| 67 | +#define ARDUINO_PIN_D4 MCU_GPIO_PORTE(14) |
| 68 | +#define ARDUINO_PIN_D5 MCU_GPIO_PORTE(11) |
| 69 | +#define ARDUINO_PIN_D6 MCU_GPIO_PORTE(9) |
| 70 | +#define ARDUINO_PIN_D7 MCU_GPIO_PORTG(12) |
| 71 | +#define ARDUINO_PIN_D8 MCU_GPIO_PORTF(3) |
| 72 | +#define ARDUINO_PIN_D9 MCU_GPIO_PORTD(15) |
| 73 | +#define ARDUINO_PIN_D10 MCU_GPIO_PORTD(14) |
| 74 | +#define ARDUINO_PIN_D11 MCU_GPIO_PORTB(5) |
| 75 | +#define ARDUINO_PIN_D12 MCU_GPIO_PORTA(6) |
| 76 | +#define ARDUINO_PIN_D13 MCU_GPIO_PORTA(5) |
| 77 | +#define ARDUINO_PIN_A0 MCU_GPIO_PORTA(3) |
| 78 | +#define ARDUINO_PIN_A1 MCU_GPIO_PORTC(0) |
| 79 | +#define ARDUINO_PIN_A2 MCU_GPIO_PORTC(3) |
| 80 | +#define ARDUINO_PIN_A3 MCU_GPIO_PORTB(1) |
| 81 | +#define ARDUINO_PIN_A4 MCU_GPIO_PORTC(2) |
| 82 | +#define ARDUINO_PIN_A5 MCU_GPIO_PORTF(10) |
| 83 | + |
| 84 | +#define ARDUINO_PIN_RX ARDUINO_PIN_D0 |
| 85 | +#define ARDUINO_PIN_TX ARDUINO_PIN_D1 |
| 86 | + |
| 87 | +#define ARDUINO_PIN_SCL MCU_GPIO_PORTB(8) |
| 88 | +#define ARDUINO_PIN_SDA MCU_GPIO_PORTB(9) |
| 89 | + |
| 90 | +#define ARDUINO_PIN_SCK ARDUINO_PIN_D13 |
| 91 | +#define ARDUINO_PIN_MOSI ARDUINO_PIN_D11 |
| 92 | +#define ARDUINO_PIN_MISO ARDUINO_PIN_D12 |
| 93 | + |
| 94 | +#ifdef __cplusplus |
| 95 | +} |
| 96 | +#endif |
| 97 | + |
| 98 | +#endif /* H_BSP_H */ |
0 commit comments