Skip to content

Commit

Permalink
target: add initial russian woodpecker port
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Silva <perigoso@riseup.net>
  • Loading branch information
perigoso committed Jul 2, 2022
1 parent 0fca297 commit d6aed0c
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/linker/russian-woodpecker/russian-woodpecker.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

INCLUDE sam3u/sam3u2.ld
2 changes: 2 additions & 0 deletions config/targets/russian-woodpecker.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
family = 'sam3u'
has-config = true
13 changes: 13 additions & 0 deletions src/targets/russian-woodpecker/config/russian-woodpecker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: 2021 Rafael Silva <perigoso@riseup.net>
*/

/* clang-format off */

/* General Config */

#define __SAM3U2C__

/* Clock Config */
#define EXTERNAL_CLOCK_VALUE 12000000UL
24 changes: 24 additions & 0 deletions src/targets/russian-woodpecker/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: 2022 Rafael Silva <perigoso@riseup.net>
*/

#include "util/data.h"
#include "util/types.h"

#include "platform/sam3u/eefc.h"
#include "platform/sam3u/pmc.h"
#include "platform/sam3u/wdt.h"

void main()
{
pmc_init(EXTERNAL_CLOCK_VALUE, 0UL);
pmc_update_clock_tree();

wdt_disable();

// systick_init();

for (;;) {
}
}
42 changes: 42 additions & 0 deletions src/targets/russian-woodpecker/tusb_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: 2021 Rafael Silva <perigoso@riseup.net>
*/

/* Common Configuration */

#define CFG_TUSB_MCU OPT_MCU_SAM3U

#define CFG_TUSB_OS OPT_OS_NONE

#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED)

/*
* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
* into those specific section.
* e.g
* - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
*/
#ifndef CFG_TUSB_MEM_SECTION
#define CFG_TUSB_MEM_SECTION
#endif

#ifndef CFG_TUSB_MEM_ALIGN
#define CFG_TUSB_MEM_ALIGN __attribute__((aligned(4)))
#endif

/* Device Configuration */

#define CFG_TUD_ENDPOINT0_SIZE 64

/* Class */
#define CFG_TUD_HID 3
#define CFG_TUD_CDC 0
#define CFG_TUD_MSC 0
#define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0

/* HID buffer size Should be sufficient to hold ID (if any) + Data */
#define CFG_TUD_HID_BUFSIZE 64

0 comments on commit d6aed0c

Please sign in to comment.