adapting Zephyr to a new platform?

60 views
Skip to first unread message

Eric Smith

unread,
Nov 16, 2018, 6:20:40 PM11/16/18
to softcpu...@riscv.org
If anyone has already done the work of adapting Zephyr to a new platform, what did you have to do?

I was hoping to take the HiFive1 support and tweak it for my core; I mostly just need to change the memory map and a little bit of the from-reset startup code. I intend to have RAM addressed from 0x00000000 up, with reset starting at 0x00000000. My core has a little bit of special stuff near 0, so at address 0 I need to have a jump instruction to the real code.

I've already gotten lost trying to figure out the linker script; I can't figure out where the variable definitions for CONFIG_RISCV_ROM_BASE_ADDR, CONFIG_RISCV_ROM_SIZE, CONFIG_RISCV_RAM_BASE_ADDR, and RISCV_RAM_SIZE are supposed to be.  It looks like there are non-RISCV-specific definitions for CONFIG_FLASH_BASE_ADDRESS and CONFIG_SRAM_BASE_ADDRESS, but I haven't really found where those are set either.

If need be, I can change my RAM base address, but I'd prefer not to.

Thanks in advance!
Eric

Nelson Ribeiro

unread,
Nov 16, 2018, 6:33:02 PM11/16/18
to Eric Smith, softcpu...@riscv.org
My github repo is messy (WIP...), but I have a patch with my modifications:

--
You received this message because you are subscribed to the Google Groups "RISC-V Soft CPU Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to softcpu-discu...@riscv.org.
To post to this group, send email to softcpu...@riscv.org.
Visit this group at https://groups.google.com/a/riscv.org/group/softcpu-discuss/.
To view this discussion on the web visit https://groups.google.com/a/riscv.org/d/msgid/softcpu-discuss/CAFrGgTRCPe%3DJ1ZkfAZbzdS7n%2BBf%2BpCQCF81YvHE2u6dj7993Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/riscv.org/d/optout.

Eric Smith

unread,
Nov 16, 2018, 6:41:21 PM11/16/18
to ngrr.r...@gmail.com, softcpu...@riscv.org
On Fri, Nov 16, 2018 at 4:33 PM Nelson Ribeiro <ngrr.r...@gmail.com> wrote:
My github repo is messy (WIP...), but I have a patch with my modifications:

Thank you!

Nelson Ribeiro

unread,
Nov 16, 2018, 6:47:58 PM11/16/18
to Eric Smith, softcpu...@riscv.org
I cannot guarantee that my implementation works, but examples do compile and I checked the objdump output, and they seemed OK.

Nelson

Nelson Ribeiro

unread,
Nov 16, 2018, 6:51:39 PM11/16/18
to Eric Smith, softcpu...@riscv.org
Ah, with those sizes for Rom and Ram defined, one of the examples do not compile. I beleive that you need slightly more than 16kbytes of Rom defined.

Nelson

Antti Lukats

unread,
Nov 17, 2018, 4:18:04 AM11/17/18
to RISC-V Soft CPU Discussion, spac...@gmail.com

On Saturday, 17 November 2018 00:51:39 UTC+1, Nelson Ribeiro wrote:
Ah, with those sizes for Rom and Ram defined, one of the examples do not compile. I beleive that you need slightly more than 16kbytes of Rom defined.

Nelson

I have also seen that 16K ROM is not sufficient, for Zephyr


I guess about 20K + 4K is minimal, 32K shared code/data works in any case

g
Antti

Frank Buss

unread,
Nov 18, 2018, 8:51:30 AM11/18/18
to RISC-V Soft CPU Discussion
And here you can see how Antti did it, with the very useful "compare" function of Github:


Similar to what Nelson did.

But you don't have to modify Zephyr. I enhanced my emulator, it is now qemu compatible, at least regarding the required functionality for the Zepyhr programs, which doesn't need that much extra functions:


It runs the philosophers and synchronization applications, and passes all 55 compliance tests. Instructions how to compile and use it are at the beginning of the code.

It wasn't easy to find all information about the details of how interrupts, exceptions and ECALLs work. I tried to summarize it in this posting, if someone else is struggling with it:


Now I guess I could just compile the C code for a 6502 core, but it wouldn't beat the 220 LUTs of the smallest design. Looks like still some work to do, but I have some ideas.
Reply all
Reply to author
Forward
0 new messages