Skip to content

Commit 01c5d4e

Browse files
author
Nathan Seidle
committed
Add variant for Ambiq SBL
Allows users to push code using the Ambiq toolchain and into 0xC000 start space in linker. This would overwrite (and/or update) the Artemis Bootloader. Not a huge deal since the ABL is just a sketch that can be reloaded but this variant should be used with caution.
1 parent 28c68be commit 01c5d4e

File tree

5 files changed

+609
-0
lines changed

5 files changed

+609
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Variant BSP
2+
The Board Support Package (BSP) is a feature of the AmbiqSuite SDK that allows you to:
3+
- define names and default configurations for pins
4+
- write globally-accessible routines for common functions
5+
6+
These features are potentially useful when:
7+
- designing an Apollo3-based board for a custom purpose where pin functions will be mainly static
8+
- using AmbiqSuite examples within Arduino
9+
10+
For an example of a BSP see the AmbiqSuite release 2.1.0 SDK under 'SDK/boards/Apollo3_EVB/bsp'
11+
12+
To include BSP files (i.e. am_bsp.h, am_bsp.c, am_bsp_pins.h, am_bsp_pins.c, as well as
13+
bsp_pins.src and pinconfig.py) add " -I{build.variant.path}/bsp" to the board definition in
14+
boards.txt as part of the board.build.includes parameter.
15+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
Copyright (c) 2019 SparkFun Electronics
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.
21+
*/
22+
23+
#include "variant.h"
24+
25+
const ap3_gpio_pad_t ap3_variant_pinmap[AP3_VARIANT_NUM_PINS] = {
26+
0,
27+
1,
28+
AP3_GPIO_PAD_UNUSED,
29+
3,
30+
4,
31+
5,
32+
6,
33+
7,
34+
8,
35+
9,
36+
10,
37+
11,
38+
12,
39+
13,
40+
14,
41+
15,
42+
AP3_GPIO_PAD_UNUSED,
43+
17,
44+
AP3_GPIO_PAD_UNUSED,
45+
AP3_GPIO_PAD_UNUSED,
46+
20,
47+
21,
48+
22,
49+
23,
50+
24,
51+
25,
52+
26,
53+
27,
54+
28,
55+
29,
56+
AP3_GPIO_PAD_UNUSED,
57+
AP3_GPIO_PAD_UNUSED,
58+
AP3_GPIO_PAD_UNUSED,
59+
33,
60+
AP3_GPIO_PAD_UNUSED,
61+
AP3_GPIO_PAD_UNUSED,
62+
36,
63+
37,
64+
38,
65+
39,
66+
40,
67+
AP3_GPIO_PAD_UNUSED,
68+
42,
69+
43,
70+
44,
71+
AP3_GPIO_PAD_UNUSED,
72+
46,
73+
47,
74+
48,
75+
49,
76+
};
77+
78+
// Uart Definitions
79+
Uart Serial(0, 49, 48);// declares a Uart object called Serial using instance 0 of Apollo3 UART peripherals with RX on pin 49 and TX on pin 48 (note, you specify *pins* not Apollo3 pads. This uses the variant's pin map to determine the Apollo3 pad)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
Copyright (c) 2019 SparkFun Electronics
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.
21+
*/
22+
#ifndef _AP3_VARIANT_H_
23+
#define _AP3_VARIANT_H_
24+
25+
#include "Arduino.h"
26+
27+
#define AP3_VARIANT_NUM_PINS (50)
28+
29+
// Pin map declaration
30+
extern const ap3_gpio_pad_t ap3_variant_pinmap[AP3_VARIANT_NUM_PINS];
31+
32+
// Uart declarations
33+
class Uart; // Forward declaration of Uart
34+
extern Uart Serial;
35+
36+
// Wire defines
37+
#define WIRE_INTERFACES_COUNT 2
38+
39+
#define WireQwiic Wire // Giving Wire an alias of "WireQwiic" in case people want to use it
40+
#define AP3_Wire_IOM 4 // Secify that Wire uses IOMaster instance 4
41+
42+
#define WireAccel Wire1
43+
#define AP3_Wire1_IOM 3
44+
45+
// SPI Defines
46+
#define SPI_INTERFACES_COUNT 1
47+
48+
#define AP3_SPI_IOM 0 // Speciy that SPI uses IOMaster 0
49+
#define AP3_SPI_DUP ap3_spi_full_duplex // Specify that SPI is full-duplex (as opposed to ap3_spi_tx_only or ap3_spi_rx_only)
50+
51+
#define LED_BUILTIN 46
52+
53+
#endif // _AP3_VARIANT_H_
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/******************************************************************************
2+
*
3+
* blank_slate.ld - Linker script for applications using startup_gnu.c
4+
*
5+
*****************************************************************************/
6+
ENTRY(Reset_Handler)
7+
8+
MEMORY
9+
{
10+
FLASH (rx) : ORIGIN = 0x0000C000, LENGTH = 960K /*Start code after the Ambiq SBL rather than SparkFun ABL*/
11+
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 384K
12+
}
13+
14+
SECTIONS
15+
{
16+
.text :
17+
{
18+
. = ALIGN(4);
19+
KEEP(*(.isr_vector))
20+
KEEP(*(.patch))
21+
*(.text)
22+
*(.text*)
23+
24+
. = ALIGN(4);
25+
__init_array_start = .;
26+
KEEP(*(.init_array)) /* C++ constructors */
27+
KEEP(*(.ctors)) /* and vtable init */
28+
__init_array_end = .;
29+
30+
*(.rodata)
31+
*(.rodata*)
32+
. = ALIGN(4);
33+
_etext = .;
34+
} > FLASH
35+
36+
/* User stack section initialized by startup code. */
37+
.stack (NOLOAD):
38+
{
39+
. = ALIGN(8);
40+
*(.stack)
41+
*(.stack*)
42+
. = ALIGN(8);
43+
} > SRAM
44+
45+
.data :
46+
{
47+
. = ALIGN(4);
48+
_sdata = .;
49+
*(.data)
50+
*(.data*)
51+
. = ALIGN(4);
52+
_edata = .;
53+
} > SRAM AT>FLASH
54+
55+
/* used by startup to initialize data */
56+
_init_data = LOADADDR(.data);
57+
58+
.bss :
59+
{
60+
. = ALIGN(4);
61+
_sbss = .;
62+
*(.bss)
63+
*(.bss*)
64+
*(COMMON)
65+
. = ALIGN(4);
66+
_ebss = .;
67+
} > SRAM
68+
69+
.ARM.attributes 0 : { *(.ARM.attributes) }
70+
}

0 commit comments

Comments
 (0)