litex: move more critical code to RAM

The XIP SPI flash on Fomu is slow, which results in certain operations
taking a long time. This becomes a problem for time-critical operations
such as USB.

Move various calls into RAM to improve performance.

This includes the call to __modsi3 and __udivsi3 which are used by the
supervisor handler to determine if periodic callbacks need to be run.

This finishes fixing #3841

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-12-24 14:06:57 +08:00
parent f3e54414e5
commit 2f95cc95a4
2 changed files with 10 additions and 2 deletions

View File

@ -51,6 +51,11 @@ SECTIONS
*(.text.tu_edpt_dir)
*(.text.tu_fifo_empty)
*(.text.usbd_edpt_busy)
*(.text.usb_irq_handler)
*(.text.supervisor_tick)
*(.text.port_get_raw_ticks)
*(.text.__modsi3)
*(.text.__udivsi3)
*(.text.irq_getmask)
*(.text.irq_setmask)
*(.text.irq_pending)

View File

@ -59,12 +59,15 @@ void common_hal_mcu_delay_us(uint32_t delay) {
volatile uint32_t nesting_count = 0;
__attribute__((section(".ramtext")))
void common_hal_mcu_disable_interrupts(void) {
if (nesting_count == 0) {
irq_setie(0);
// __DMB();
}
nesting_count++;
}
__attribute__((section(".ramtext")))
void common_hal_mcu_enable_interrupts(void) {
if (nesting_count == 0) {
// This is very very bad because it means there was mismatched disable/enables so we