Skip to content

Commit

Permalink
Co Pro RISC-V: Clear escape flag on BREAK
Browse files Browse the repository at this point in the history
Change-Id: Ib2d449516b3c89888e577f6586e89abdf1a79c3a
  • Loading branch information
hoglet67 committed Oct 18, 2023
1 parent 4bf7034 commit 2552913
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
67 changes: 34 additions & 33 deletions src/riscv/tuberom.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
unsigned char tuberom_riscv_bin[] = {
0x6f, 0x00, 0x40, 0x00, 0x37, 0x01, 0xfc, 0x00, 0x13, 0x01, 0x01, 0xdf,
0x17, 0x03, 0x00, 0x00, 0x13, 0x03, 0x83, 0x19, 0xb7, 0x03, 0xfc, 0x00,
0x17, 0x03, 0x00, 0x00, 0x13, 0x03, 0x43, 0x1a, 0xb7, 0x03, 0xfc, 0x00,
0x93, 0x83, 0x03, 0xe8, 0x13, 0x0e, 0xe0, 0x00, 0x83, 0x22, 0x03, 0x00,
0x23, 0xa0, 0x53, 0x00, 0x13, 0x03, 0x43, 0x00, 0x93, 0x83, 0x43, 0x00,
0x13, 0x0e, 0xfe, 0xff, 0xe3, 0x16, 0x0e, 0xfe, 0x17, 0x03, 0x00, 0x00,
0x13, 0x03, 0x03, 0x1f, 0xb7, 0x03, 0xfc, 0x00, 0x93, 0x83, 0x03, 0xe4,
0x13, 0x03, 0xc3, 0x1f, 0xb7, 0x03, 0xfc, 0x00, 0x93, 0x83, 0x03, 0xe4,
0x13, 0x0e, 0x00, 0x01, 0x83, 0x22, 0x03, 0x00, 0x23, 0xa0, 0x53, 0x00,
0x13, 0x03, 0x43, 0x00, 0x93, 0x83, 0x43, 0x00, 0x13, 0x0e, 0xfe, 0xff,
0xe3, 0x16, 0x0e, 0xfe, 0x97, 0x12, 0x00, 0x00, 0x93, 0x82, 0x82, 0xf3,
0xe3, 0x16, 0x0e, 0xfe, 0xb7, 0x02, 0xfc, 0x00, 0x93, 0x82, 0x02, 0xe0,
0x23, 0xa0, 0x02, 0x00, 0x97, 0x12, 0x00, 0x00, 0x93, 0x82, 0x82, 0xf3,
0x73, 0x90, 0x52, 0x30, 0xb7, 0x12, 0x00, 0x00, 0x93, 0x82, 0x02, 0x80,
0x73, 0xa0, 0x42, 0x30, 0x93, 0x02, 0x80, 0x00, 0x73, 0xa0, 0x02, 0x30,
0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x75, 0x10, 0xef, 0x10, 0xc0, 0x47,
Expand All @@ -34,23 +35,23 @@ unsigned char tuberom_riscv_bin[] = {
0x11, 0x00, 0x00, 0x00, 0x45, 0x73, 0x63, 0x61, 0x70, 0x65, 0x00, 0x0a,
0x52, 0x49, 0x53, 0x43, 0x2d, 0x56, 0x20, 0x43, 0x6f, 0x20, 0x50, 0x72,
0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x0a, 0x0a, 0x0d, 0x00, 0x00,
0xdc, 0x00, 0xfc, 0x00, 0x90, 0x00, 0x00, 0x00, 0x08, 0x02, 0xfc, 0x00,
0x00, 0xfe, 0xfb, 0x00, 0xdc, 0x01, 0xfc, 0x00, 0x80, 0xff, 0xfb, 0x00,
0x20, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x02, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x50, 0x0d, 0xfc, 0x00, 0x40, 0xfe, 0xfb, 0x00,
0x50, 0x0d, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x01, 0xfc, 0x00,
0xe8, 0x00, 0xfc, 0x00, 0x90, 0x00, 0x00, 0x00, 0x14, 0x02, 0xfc, 0x00,
0x00, 0xfe, 0xfb, 0x00, 0xe8, 0x01, 0xfc, 0x00, 0x80, 0xff, 0xfb, 0x00,
0x2c, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5c, 0x0d, 0xfc, 0x00, 0x40, 0xfe, 0xfb, 0x00,
0x5c, 0x0d, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x01, 0xfc, 0x00,
0x13, 0x01, 0x01, 0xdf, 0xb7, 0x08, 0xac, 0x00, 0x93, 0x88, 0x58, 0x00,
0x73, 0x00, 0x00, 0x00, 0x13, 0x05, 0x45, 0x00, 0xef, 0x10, 0x40, 0x31,
0xb7, 0x08, 0xac, 0x00, 0x93, 0x88, 0x58, 0x00, 0x73, 0x00, 0x00, 0x00,
0x6f, 0xf0, 0x9f, 0xed, 0x33, 0x05, 0xa5, 0x00, 0xb7, 0x02, 0xfc, 0x00,
0x93, 0x82, 0xc2, 0xe8, 0x83, 0xa2, 0x02, 0x00, 0x23, 0x80, 0xa2, 0x00,
0x67, 0x80, 0x00, 0x00, 0x67, 0x80, 0x00, 0x00, 0x67, 0x80, 0x00, 0x00,
0x68, 0x02, 0xfc, 0x00, 0x78, 0x02, 0xfc, 0x00, 0x44, 0x03, 0xfc, 0x00,
0xf4, 0x03, 0xfc, 0x00, 0x98, 0x05, 0xfc, 0x00, 0xac, 0x05, 0xfc, 0x00,
0xd8, 0x05, 0xfc, 0x00, 0x0c, 0x06, 0xfc, 0x00, 0x90, 0x06, 0xfc, 0x00,
0xf4, 0x06, 0xfc, 0x00, 0x30, 0x07, 0xfc, 0x00, 0x68, 0x07, 0xfc, 0x00,
0xfc, 0x07, 0xfc, 0x00, 0x50, 0x08, 0xfc, 0x00, 0x78, 0x08, 0xfc, 0x00,
0x10, 0x09, 0xfc, 0x00, 0xb7, 0x02, 0xfc, 0x00, 0x93, 0x82, 0x02, 0xe8,
0x74, 0x02, 0xfc, 0x00, 0x84, 0x02, 0xfc, 0x00, 0x50, 0x03, 0xfc, 0x00,
0x00, 0x04, 0xfc, 0x00, 0xa4, 0x05, 0xfc, 0x00, 0xb8, 0x05, 0xfc, 0x00,
0xe4, 0x05, 0xfc, 0x00, 0x18, 0x06, 0xfc, 0x00, 0x9c, 0x06, 0xfc, 0x00,
0x00, 0x07, 0xfc, 0x00, 0x3c, 0x07, 0xfc, 0x00, 0x74, 0x07, 0xfc, 0x00,
0x08, 0x08, 0xfc, 0x00, 0x5c, 0x08, 0xfc, 0x00, 0x84, 0x08, 0xfc, 0x00,
0x1c, 0x09, 0xfc, 0x00, 0xb7, 0x02, 0xfc, 0x00, 0x93, 0x82, 0x02, 0xe8,
0x83, 0xa2, 0x02, 0x00, 0x67, 0x80, 0x02, 0x00, 0x13, 0x01, 0x01, 0xff,
0x23, 0x26, 0x11, 0x00, 0x23, 0x24, 0xa1, 0x00, 0xef, 0x00, 0x80, 0x6b,
0x63, 0x0c, 0x05, 0x02, 0x13, 0x05, 0x20, 0x00, 0xef, 0x10, 0x40, 0x26,
Expand Down Expand Up @@ -211,9 +212,9 @@ unsigned char tuberom_riscv_bin[] = {
0x13, 0x01, 0x01, 0x01, 0x67, 0x80, 0x00, 0x00, 0x93, 0x02, 0xe0, 0x02,
0x63, 0x0a, 0x53, 0x00, 0x93, 0x02, 0x10, 0x06, 0xe3, 0x48, 0x53, 0xfc,
0x93, 0x02, 0xa0, 0x07, 0xe3, 0xc4, 0x62, 0xfc, 0x13, 0x05, 0x10, 0x00,
0x6f, 0xf0, 0xdf, 0xfc, 0x20, 0x0a, 0xfc, 0x00, 0x28, 0x0a, 0xfc, 0x00,
0x7c, 0x0a, 0xfc, 0x00, 0xb8, 0x0a, 0xfc, 0x00, 0x0c, 0x0b, 0xfc, 0x00,
0x20, 0x0a, 0xfc, 0x00, 0x2e, 0x00, 0x67, 0x6f, 0x00, 0x68, 0x65, 0x6c,
0x6f, 0xf0, 0xdf, 0xfc, 0x2c, 0x0a, 0xfc, 0x00, 0x34, 0x0a, 0xfc, 0x00,
0x88, 0x0a, 0xfc, 0x00, 0xc4, 0x0a, 0xfc, 0x00, 0x18, 0x0b, 0xfc, 0x00,
0x2c, 0x0a, 0xfc, 0x00, 0x2e, 0x00, 0x67, 0x6f, 0x00, 0x68, 0x65, 0x6c,
0x70, 0x00, 0x74, 0x65, 0x73, 0x74, 0x00, 0x70, 0x69, 0x00, 0x00, 0x00,
0x13, 0x05, 0x10, 0x00, 0x67, 0x80, 0x00, 0x00, 0x13, 0x01, 0x01, 0xff,
0x23, 0x26, 0x11, 0x00, 0x23, 0x24, 0x11, 0x01, 0xef, 0x00, 0xd0, 0x1d,
Expand Down Expand Up @@ -374,9 +375,9 @@ unsigned char tuberom_riscv_bin[] = {
0x13, 0x03, 0xc3, 0xe0, 0x23, 0x20, 0x03, 0x00, 0x03, 0x23, 0x01, 0x00,
0x73, 0x10, 0x03, 0x30, 0x03, 0x23, 0x41, 0x00, 0x73, 0x10, 0x13, 0x34,
0x03, 0x23, 0xc1, 0x00, 0x83, 0x23, 0x81, 0x00, 0x13, 0x01, 0x01, 0x01,
0x6f, 0xf0, 0xdf, 0xe5, 0xb8, 0x11, 0xfc, 0x00, 0xdc, 0x11, 0xfc, 0x00,
0xfc, 0x11, 0xfc, 0x00, 0x28, 0x12, 0xfc, 0x00, 0x50, 0x12, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x12, 0xfc, 0x00, 0x98, 0x12, 0xfc, 0x00,
0x6f, 0xf0, 0xdf, 0xe5, 0xc4, 0x11, 0xfc, 0x00, 0xe8, 0x11, 0xfc, 0x00,
0x08, 0x12, 0xfc, 0x00, 0x34, 0x12, 0xfc, 0x00, 0x5c, 0x12, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6c, 0x12, 0xfc, 0x00, 0xa4, 0x12, 0xfc, 0x00,
0x83, 0x22, 0x03, 0x00, 0xe3, 0x8e, 0x02, 0xfa, 0x83, 0x82, 0x01, 0x01,
0x93, 0xf2, 0x02, 0x04, 0xe3, 0x88, 0x02, 0xfe, 0x83, 0x82, 0x03, 0x00,
0x23, 0x8a, 0x51, 0x00, 0x93, 0x83, 0x13, 0x00, 0x6f, 0xf0, 0x1f, 0xfe,
Expand Down Expand Up @@ -473,18 +474,18 @@ unsigned char tuberom_riscv_bin[] = {
0x00, 0x6d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3d, 0x00, 0x20, 0x6d,
0x63, 0x61, 0x75, 0x73, 0x65, 0x3d, 0x00, 0x2a, 0x2a, 0x2a, 0x20, 0x00,
0x20, 0x2a, 0x2a, 0x2a, 0x0a, 0x0d, 0x00, 0x52, 0x65, 0x67, 0x69, 0x73,
0x74, 0x65, 0x72, 0x20, 0x64, 0x75, 0x6d, 0x70, 0x00, 0xc1, 0x16, 0xfc,
0x00, 0xda, 0x16, 0xfc, 0x00, 0x0a, 0x19, 0xfc, 0x00, 0xf9, 0x16, 0xfc,
0x00, 0x15, 0x17, 0xfc, 0x00, 0x2b, 0x17, 0xfc, 0x00, 0x0a, 0x19, 0xfc,
0x00, 0x47, 0x17, 0xfc, 0x00, 0x60, 0x17, 0xfc, 0x00, 0x79, 0x17, 0xfc,
0x00, 0x0a, 0x19, 0xfc, 0x00, 0x98, 0x17, 0xfc, 0x00, 0x0a, 0x19, 0xfc,
0x00, 0x0a, 0x19, 0xfc, 0x00, 0x0a, 0x19, 0xfc, 0x00, 0x0a, 0x19, 0xfc,
0x00, 0xb4, 0x17, 0xfc, 0x00, 0xd4, 0x17, 0xfc, 0x00, 0xee, 0x17, 0xfc,
0x00, 0x03, 0x18, 0xfc, 0x00, 0x0f, 0x18, 0xfc, 0x00, 0x28, 0x18, 0xfc,
0x00, 0x3b, 0x18, 0xfc, 0x00, 0x59, 0x18, 0xfc, 0x00, 0x71, 0x18, 0xfc,
0x00, 0x8f, 0x18, 0xfc, 0x00, 0x0a, 0x19, 0xfc, 0x00, 0xad, 0x18, 0xfc,
0x00, 0xcb, 0x18, 0xfc, 0x00, 0xe3, 0x18, 0xfc, 0x00, 0x0a, 0x19, 0xfc,
0x00, 0xf4, 0x18, 0xfc, 0x00, 0x55, 0x73, 0x65, 0x72, 0x20, 0x73, 0x6f,
0x74, 0x65, 0x72, 0x20, 0x64, 0x75, 0x6d, 0x70, 0x00, 0xcd, 0x16, 0xfc,
0x00, 0xe6, 0x16, 0xfc, 0x00, 0x16, 0x19, 0xfc, 0x00, 0x05, 0x17, 0xfc,
0x00, 0x21, 0x17, 0xfc, 0x00, 0x37, 0x17, 0xfc, 0x00, 0x16, 0x19, 0xfc,
0x00, 0x53, 0x17, 0xfc, 0x00, 0x6c, 0x17, 0xfc, 0x00, 0x85, 0x17, 0xfc,
0x00, 0x16, 0x19, 0xfc, 0x00, 0xa4, 0x17, 0xfc, 0x00, 0x16, 0x19, 0xfc,
0x00, 0x16, 0x19, 0xfc, 0x00, 0x16, 0x19, 0xfc, 0x00, 0x16, 0x19, 0xfc,
0x00, 0xc0, 0x17, 0xfc, 0x00, 0xe0, 0x17, 0xfc, 0x00, 0xfa, 0x17, 0xfc,
0x00, 0x0f, 0x18, 0xfc, 0x00, 0x1b, 0x18, 0xfc, 0x00, 0x34, 0x18, 0xfc,
0x00, 0x47, 0x18, 0xfc, 0x00, 0x65, 0x18, 0xfc, 0x00, 0x7d, 0x18, 0xfc,
0x00, 0x9b, 0x18, 0xfc, 0x00, 0x16, 0x19, 0xfc, 0x00, 0xb9, 0x18, 0xfc,
0x00, 0xd7, 0x18, 0xfc, 0x00, 0xef, 0x18, 0xfc, 0x00, 0x16, 0x19, 0xfc,
0x00, 0x00, 0x19, 0xfc, 0x00, 0x55, 0x73, 0x65, 0x72, 0x20, 0x73, 0x6f,
0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x72, 0x75, 0x70, 0x74, 0x00, 0x00, 0x53, 0x75, 0x70, 0x65, 0x72, 0x76,
0x69, 0x73, 0x6f, 0x72, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72,
Expand Down Expand Up @@ -567,4 +568,4 @@ unsigned char tuberom_riscv_bin[] = {
0x03, 0x29, 0x01, 0x01, 0x83, 0x29, 0xc1, 0x00, 0x03, 0x2a, 0x81, 0x00,
0x13, 0x01, 0x01, 0x02, 0x67, 0x80, 0x00, 0x00
};
unsigned int tuberom_riscv_bin_len = 6800;
unsigned int tuberom_riscv_bin_len = 6812;
3 changes: 3 additions & 0 deletions src/riscv/tuberom_riscv.s
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ InitECallLoop:
addi t3, t3, -1
bnez t3, InitECallLoop

la t0, ESCFLG # clear the default escape flag
sw zero, (t0)

la t0, InterruptHandler # install the interrupt/exception handler
csrw mtvec, t0
li t0, 1 << 11 # mie.MEIE=1 (enable external interrupts)
Expand Down

0 comments on commit 2552913

Please sign in to comment.