Skip to content

Make the number of interrupt vectors configurable - #8

Open
rhgndf wants to merge 2 commits into
cyrozap:masterfrom
rhgndf:configurable-interrupt-amount
Open

Make the number of interrupt vectors configurable#8
rhgndf wants to merge 2 commits into
cyrozap:masterfrom
rhgndf:configurable-interrupt-amount

Conversation

@rhgndf

@rhgndf rhgndf commented Jun 16, 2026

Copy link
Copy Markdown

Some modern 8051 microcontrollers have a lot of ISRs. STC8H8K64U for example has 28. Hopefully this PR should be a simple enough one that isn't intrusive at all.
Would be an interesting idea to see if this allows porting of libraries like TinyUSB to it.

@rhgndf
rhgndf force-pushed the configurable-interrupt-amount branch 3 times, most recently from ccec189 to 4e72f20 Compare June 16, 2026 08:32
@cyrozap

cyrozap commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR. IIRC, the reason I wrote the code in 99d5a71 the way I did was to make it straightforward to either add some indicator as to which 8051 interrupt source triggered the RISC-V interrupt or to implement a custom interrupt handler in the 8051 code (since handling it in the emulated RISC-V might be to slow for some interrupts). If we're going to abandon that, it would probably be better to make the macro emit setb misc_bit0__new_interrupt; reti directly instead of an ljmp to a common setb misc_bit0__new_interrupt; reti, just to avoid the indirection. If you make that change, I'll merge this PR.

Probably the long term strategy should be to do what you suggested in #9, since right now there's no way for the RISC-V code to know which interrupt was fired without checking literally every interrupt source on the microcontroller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants