Skip to content

Commit

Permalink
Add Arduino firmware support for duos
Browse files Browse the repository at this point in the history
Signed-off-by: Cheng Li <[email protected]>
  • Loading branch information
shiptux committed Jul 15, 2024
1 parent 28bb62d commit 0327857
Show file tree
Hide file tree
Showing 4 changed files with 1,603 additions and 0 deletions.
233 changes: 233 additions & 0 deletions variants/duos/link.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
/*******************************************************************/
/* */
/* This file is automatically generated by linker script generator.*/
/* */
/* Version: */
/* */
/* Copyright (c) 2010-2016 Xilinx, Inc. All rights reserved. */
/* */
/* Description : Cortex-A53 Linker Script */
/* */
/*******************************************************************/
OUTPUT_ARCH( "riscv" )
OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")

_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x40000;
/*_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x1000000;*/
_HEAP_SIZE = 0x80000;

_EL0_STACK_SIZE = DEFINED(_EL0_STACK_SIZE) ? _EL0_STACK_SIZE : 1024;
_EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 2048;
_EL2_STACK_SIZE = DEFINED(_EL2_STACK_SIZE) ? _EL2_STACK_SIZE : 1024;

/* Define Memories in the system */

MEMORY
{
psu_ddr_0_MEM_0 : ORIGIN = 0x9fe00000 , LENGTH = 0x200000
}

/* Specify the default entry point to the program */

/*ENTRY(_vector_table)*/
ENTRY(Reset_Handler)

/* Define the sections, and where they are mapped in memory */

SECTIONS
{
.text : {
KEEP (*(.vectors))
*(.boot)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.plt)
*(.gnu_warning)
*(.gcc_execpt_table)
*(.glue_7)
*(.glue_7t)
*(.ARM.extab)
*(.gnu.linkonce.armextab.*)
} > psu_ddr_0_MEM_0

.init (ALIGN(64)) : {
KEEP (*(.init))
} > psu_ddr_0_MEM_0

.fini (ALIGN(64)) : {
KEEP (*(.fini))
} > psu_ddr_0_MEM_0

.interp : {
KEEP (*(.interp))
} > psu_ddr_0_MEM_0

.note-ABI-tag : {
KEEP (*(.note-ABI-tag))
} > psu_ddr_0_MEM_0

.rodata : {
. = ALIGN(64);
__rodata_start = .;
*(.rodata)
*(.rodata.*)
*(.srodata*)
*(.gnu.linkonce.r.*)
__rodata_end = .;
} > psu_ddr_0_MEM_0

.rodata1 : {
. = ALIGN(64);
__rodata1_start = .;
*(.rodata1)
*(.rodata1.*)
__rodata1_end = .;
} > psu_ddr_0_MEM_0

.rodata2 : {
__init_array_start = .;
__ctors_start__ = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
__ctors_end__ = .;

__fini_array_start = .;
__dtors_start__ = .;
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
__fini_array_end = .;
__dtors_end__ = .;

__ctor_start__ = .;
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__ctor_end__ = .;
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__dtor_end__ = .;
. = ALIGN(0x8) ;
} > psu_ddr_0_MEM_0

.data : {
. = ALIGN(64);
_data = .;
*(.data)
*(.data.*)
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.d.*)
*(.jcr)
*(.got)
*(.got.plt)
_edata = .;
} > psu_ddr_0_MEM_0

.data1 : {
. = ALIGN(64);
__data1_start = .;
*(.data1)
*(.data1.*)
__data1_end = .;
} > psu_ddr_0_MEM_0

.resource_table :
{
KEEP(*(.resource_table));
} > psu_ddr_0_MEM_0

.got : {
*(.got)
} > psu_ddr_0_MEM_0

.got1 : {
*(.got1)
} > psu_ddr_0_MEM_0

.got2 : {
*(.got2)
} > psu_ddr_0_MEM_0

.ctors : {
. = ALIGN(64);
__CTOR_LIST__ = .;
___CTORS_LIST___ = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
___CTORS_END___ = .;
} > psu_ddr_0_MEM_0

.dtors : {
. = ALIGN(64);
__DTOR_LIST__ = .;
___DTORS_LIST___ = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
___DTORS_END___ = .;
} > psu_ddr_0_MEM_0

.fixup : {
__fixup_start = .;
*(.fixup)
__fixup_end = .;
} > psu_ddr_0_MEM_0

.eh_frame : {
*(.eh_frame)
} > psu_ddr_0_MEM_0

.eh_framehdr : {
__eh_framehdr_start = .;
*(.eh_framehdr)
__eh_framehdr_end = .;
} > psu_ddr_0_MEM_0

.gcc_except_table : {
*(.gcc_except_table)
} > psu_ddr_0_MEM_0

.bss (NOLOAD) : {
. = ALIGN(64);
_bss = .;
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(64);
_ebss = .;
end = .;
} > psu_ddr_0_MEM_0

/* Generate Stack and Heap definitions */

.heap (NOLOAD) : {
. = ALIGN(64);
_heap = .;
HeapBase = .;
_heap_start = .;
*(.heap*)
. += _HEAP_SIZE;
_heap_size = _HEAP_SIZE;
_heap_end = .;
HeapLimit = .;
} > psu_ddr_0_MEM_0

.stack (NOLOAD) : {
. = ALIGN(64);
_stack_end_end = .;
. += _STACK_SIZE;
_stack_top = .;
} > psu_ddr_0_MEM_0

_end = .;
}

22 changes: 22 additions & 0 deletions variants/duos/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef VARIANT_H
#define VARIANT_H
#include "variant_pins.h"
#include "../duo/variant_soc.h"

#define DEBUG_SERIAL Serial3
#define DEBUG_UART_BASE DW_UART3_BASE

#define CONFIG_BOARD_CV181XH 1
#define WIRE_INTERFACES_COUNT 5
#define OUT_PIN_NUM 53

#define digitalPinToInterrupt(p) (((p) < CONFIG_GPIO_NUM * 32) ? (p) : -1)

#define SERIAL_INTERFACES_COUNT 4
#define Wire Wire1
#define PIN_SPI2_SCK PIN_SPI3_SCK
#define PIN_SPI2_MISO PIN_SPI3_MISO
#define PIN_SPI2_MOSI PIN_SPI3_MOSI
#define PIN_SPI2_CS PIN_SPI3_CS

#endif
Loading

0 comments on commit 0327857

Please sign in to comment.