-
-
Notifications
You must be signed in to change notification settings - Fork 779
hifive1: Upgrade to the revB board #1847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I got uart working by:
|
Now that I think about it maybe I'm always getting some other non-UART interrupt. I'll dig more into that today. |
|
Yeah that is definitely an interrupt-related issue. |
|
Ah, figured it out. It looks like interrupts aren't correctly re-enabled after being globally disabled. |
7c3dc5b to
2867f8c
Compare
|
The Travis failure is because it's QEMU cache is out of date. |
|
I tried running libtock-c/blink. I get: with this libtock-c diff from the riscv branch: diff --git a/Configuration.mk b/Configuration.mk
index 6a9fee7..786d1e9 100644
--- a/Configuration.mk
+++ b/Configuration.mk
@@ -39,6 +39,7 @@ ifndef ELF2TAB_EXISTS
endif
ELF2TAB_ARGS += -n $(PACKAGE_NAME)
ELF2TAB_ARGS += --stack $(STACK_SIZE) --app-heap $(APP_HEAP_SIZE) --kernel-heap $(KERNEL_HEAP_SIZE)
+ELF2TAB_ARGS += --fixed-address-ram 0x80002400 --fixed-address-flash 0x20040040
# Special extra flag for RISC-V since it does not have PIC support.
ELF2TAB_ARGS += --protected-region-size=64
diff --git a/userland_generic.ld b/userland_generic.ld
index bf69caa..bd12da1 100644
--- a/userland_generic.ld
+++ b/userland_generic.ld
@@ -15,8 +15,8 @@ ENTRY(_start)
* actual location in flash where the app is placed.
*/
MEMORY {
- FLASH (rx) : ORIGIN = 0x4043003c, LENGTH = PROG_LENGTH
- SRAM (RWX) : ORIGIN = 0x80004000, LENGTH = RAM_LENGTH
+ FLASH (rx) : ORIGIN = 0x20040040, LENGTH = PROG_LENGTH
+ SRAM (RWX) : ORIGIN = 0x80002400, LENGTH = RAM_LENGTH
}
SECTIONS {this make command: and this tock diff: diff --git a/boards/hifive1/src/main.rs b/boards/hifive1/src/main.rs
index e38b29c99..268dc7187 100644
--- a/boards/hifive1/src/main.rs
+++ b/boards/hifive1/src/main.rs
@@ -36,7 +36,7 @@ const FAULT_RESPONSE: kernel::procs::FaultResponse = kernel::procs::FaultRespons
// RAM to be shared by all application processes.
#[link_section = ".app_memory"]
-static mut APP_MEMORY: [u8; 5 * 1024] = [0; 5 * 1024];
+static mut APP_MEMORY: [u8; (10* 1024)-3072] = [0; (10 * 1024)-3072];
/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]The fixed-addresses stuff if WIP, but it's just for checking and can be ignored. I also merged pr #1845 into this PR branch. |
|
Thanks @bradjc . Just to clarify are you saying that apps work (with libtock changes)? If so I think this is ready to merge. On the OpenOCD front I have sent patches to OpenOCD, the RISC-V fork of OpenOCD and libjaylink to add support. Once they are merged OpenOCD should be working. |
|
I can't get the apps to fit. Event the blinky or hello_world libtock-rs apps are too big. |
ba32b30 to
2de9723
Compare
|
Got it! I have pushed the working version.
I have tested on libtock-rs and will send the patches once this is merged. All I need is an address change and reduce the app stack size to fit. @bradjc I forced pushed over your readme update. Can you apply it again. Sorry about that. |
|
My status:
If I switch to today's nightly, I get: And if I make a custom syscall formatter I can get the full print out (sometimes): Othertimes it gets stuck here: I'm not sure what is going on there. |
|
Also I seem to get different behavior sometimes, or immediately after flashing the kernel, or after unplugging and replugging the board. |
|
Hmm... It seems like you are getting strange interrupt as well. |
|
Maybe try disabling PMP? See if that helps |
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Re-write the interrupt handling logic to follow what the Ibex chip does. This is a simpler implemenation and fixes cases where interrupts aren't re-enabled after being disabled. Signed-off-by: Alistair Francis <[email protected]>
This is already turned off in OpenOCD, plus the current way in Tock doesn't work, so let's remove it. Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
The SiFive FE310-G002 chip supports PMP with 8 regions and a 4 byte granularity, enable it for the chip. Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>
Use a fork of QEMU (patches are pending on the mailing list) that supports the hifve1 and OpenTitan. Signed-off-by: Alistair Francis <[email protected]>
afe47d3 to
6f349c4
Compare
|
Draft PR send to @bradjc Two things I noticed.
|
|
It's actually blinking on the board! Using the debug build was the trick. |
|
Awesome!
Then we should be able to merge this |
6f349c4 to
82b16d5
Compare
Increase the app memory size to allow more/bigger apps to fit. Signed-off-by: Alistair Francis <[email protected]>
82b16d5 to
efd0489
Compare
|
Cleared the Travis cache, the build is passing now :) |
|
Should we change the makefile to |
|
I don't think so, the release version works with libtock-rs and it's so space constrained that the debug build makes a substantial difference. |
|
I wonder why libtock-rs would be different. I can't get libtock-rs to work at the moment. Is it easy to trigger a fault? Does the fault message print with the release kernel build? |
|
If you set a stack size that is too large it will fault. The fault messages aren't printed fully in the release build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's definitely still something wrong that ends up with print formatting breaking and other weird issues, but this is overall a good step towards hifive1b support.
One other note: the 16k RAM is very limiting. This isn't really a suitable Tock board, and hopefully other easily available RISC-V hardware will continue to come out and we can replace this with something.
|
bors r+ |
|
Build failed: |
|
Argh! It looks like Bors has it's own Travis cache. Can that be cleared? |
|
bors retry just did |
Pull Request Overview
This PR updates the current HiFive1 to board in tock to use the revB version instead.
Testing Strategy
Tested by running on a revB board. UART does work, but only when GDB is connected, so something still seems wrong with the UART.
I tried to run an app and it looks like it didn't work.
TODO or Help Wanted
Documentation Updated
/docs, or no updates are required.Formatting
make formatall.