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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/machine/machine_esp32c6.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const deviceName = esp.Device
const maxPin = 31
const cpuInterruptFromPin = 6

// CPU interrupts 3, 4 and 7 are bound to the CLINT and cannot be used.
// See ESP-IDF esp_hw_support/port/esp32c6/esp_cpu_intr.c.
const cpuInterruptFromUART = 13

// CPUFrequency returns the current CPU frequency of the chip.
// Currently it is a fixed frequency but it may allow changing in the future.
func CPUFrequency() uint32 {
Expand Down Expand Up @@ -477,9 +481,9 @@ func (uart *UART) configureInterrupt(intrMapReg *volatile.Register32) {
// Disable all UART interrupts
uart.Bus.INT_ENA.ClearBits(0x0ffff)

intrMapReg.Set(7)
intrMapReg.Set(cpuInterruptFromUART)
onceUart.Do(func() {
_ = interrupt.New(7, func(i interrupt.Interrupt) {
_ = interrupt.New(cpuInterruptFromUART, func(i interrupt.Interrupt) {
UART0.serveInterrupt(0)
UART1.serveInterrupt(1)
}).Enable()
Expand Down
5 changes: 5 additions & 0 deletions targets/esp32c6.ld
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ SECTIONS
.text : ALIGN(4)
{
*(.text .text.*)
/* Put the .rodata data at a 16-byte aligned flash offset, the same as its address. */
. = ALIGN(. + 0x8, 16) - 0x8;
} > IROM

/* === DROM sections (flash-mapped read-only data) === */
Expand All @@ -151,6 +153,9 @@ SECTIONS
. = ALIGN (4);
} >DROM

ASSERT(ADDR(.text) == ADDR(.irom_dummy) + SIZEOF(.irom_dummy), ".text address does not match its flash offset")
ASSERT(ADDR(.rodata) == ADDR(.rodata_dummy) + SIZEOF(.rodata_dummy), ".rodata address does not match its flash offset")

/DISCARD/ :
{
*(.eh_frame) /* we don't do exception handling in C */
Expand Down
Loading