You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Keith P <ke...@gmail.com> on 2025/06/25 07:36:41 UTC

New MCU Porting Help

Hello everyone,

I am an intern at a lab and don't really get how to continue with porting,
I have made a few files and copied some code from the mcu's original SDK
<https://gitlab.com/shaktiproject/software/shakti-sdk>.

I am porting to the Shakti line of MCU's, they are fully open-source RISCV
based MCUs.

I have followed the fairly short porting guide and have been trying to use
the FE310 bsp implementation by SiFive as a template/guide since that is
also a RISCV board.

My task as of now is to get UART working.

Here are the directories I've added:
repos/apache-mynewt-core/hw/bsp/shakti_parashu/
├── bsp.yml
├── include
│   └── bsp
│       └── bsp.h
├── parashu_boot.ld
├── parashu.ld
├── pkg.yml
├── src
│   └── hal_bsp.c
└── syscfg.yml

3 directories, 7 files

repos/apache-mynewt-core/hw/mcu/shakti/
├── parashu
│   ├── include
│   │   ├── clint.h
│   │   ├── defines.h
│   │   ├── mcu
│   │   │   ├── parashu.h
│   │   │   ├── parashu_hal.h
│   │   │   ├── platform.h
│   │   │   └── sys_clock.h
│   │   ├── plic.h
│   │   └── traps.h
│   ├── pkg.yml
│   ├── src
│   │   ├── arch
│   │   │   └── rv32imacu
│   │   │       └── start.S
│   │   ├── clint.c
│   │   ├── hal_flash.c
│   │   ├── hal_os_tick.c
│   │   ├── hal_reset_cause.c
│   │   ├── hal_system.c
│   │   ├── hal_uart.c
│   │   ├── init.c
│   │   ├── plic.c
│   │   ├── sys_clock.c
│   │   └── traps.c
│   └── syscfg.yml
└── pkg.yml

6 directories, 22 files

repos/apache-mynewt-core/kernel/os/src/arch/shakti/
├── start.S
└── trap.S

0 directories, 2 files

repos/apache-mynewt-core/compiler/riscv64-unknown-elf-shakti/
├── compiler.yml
└── pkg.yml

0 directories, 2 files

I forked the mynewt-core repo and uploaded my changes to the fork
<https://github.com/Keith-C-P/shakti-mynewt-core>.

The code compiles, but the dump looks all wrong as major sections are
missing, like main and others

I did compile mynewt for both native (linux) and for hifive1, i ran hifive1
on a qemu vm as I don't have access to the actual board, but both worked
fine.

I'll be honest I don't know what questions to ask as I am just starting to
get into the embedded field and wanted a difficult project so I can learn
fast.

Any and all help would be greatly appreciated
Thanks in advance

Regards,
Keith

Re: New MCU Porting Help

Posted by Jerzy Kasenberg <je...@codecoup.pl>.
Let's keep conversation here so other may benefit.

You can try to reaching me on slack mynewt general channel.

Jerzy

pt., 27 cze 2025 o 11:42 Keith P <ke...@gmail.com> napisał(a):

> Hi Jerzy,
>
> The build tools are available here:
> https://gitlab.com/shaktiproject/software/riscv-tools
> The code is ran on an FPGA (Arty A7-100T), there is a qemu vm but it
> doesn't work correctly.
>
> I realised that the _start may already be defined while looking closer at
> the Hifive1 startup code, I'll make those changes.
> Is it possible that we can get on a call if you are free on the weekend?
>
> Regards,
> Keith
>
> On Thu, Jun 26, 2025 at 3:49 PM Jerzy Kasenberg <
> jerzy.kasenberg@codecoup.pl>
> wrote:
>
> > Hi Keith,
> >
> > Your code defines _start as staring point and it also defines this
> > function.
> > This function initializes bss and calls init then it ends with busy loop.
> >
> > To make it link more code you could change your startup function to
> > different name
> > then after your init (or at the end of this function) you could call
> _start
> > function that is present
> > in baselib.c and that would start more mynewt code.
> >
> > Keep in mind that mynewt expect maynew_main function (not main) to be
> > starting point of application.
> >
> > regards
> > Jerzy
> >
> >
> > czw., 26 cze 2025 o 10:18 Jerzy Kasenberg <je...@codecoup.pl>
> > napisał(a):
> >
> > > Hi Keith,
> > >
> > > I did port of hifive1 few years back but I don't have setup ready.
> > > Can you tell me what system you are using for development and how to
> get
> > > build tools you have?
> > > If I can setup environment again I'm pretty sure we can make this work.
> > > Originally compiler used for HiFive1 board was downloaded from SiFive
> > site
> > > I don't know
> > > it this is the one you are using and if the one I used is still there
> > >
> > > regards
> > > Jerzy
> > >
> > >
> > > śr., 25 cze 2025 o 09:37 Keith P <ke...@gmail.com> napisał(a):
> > >
> > >> Hello everyone,
> > >>
> > >> I am an intern at a lab and don't really get how to continue with
> > porting,
> > >> I have made a few files and copied some code from the mcu's original
> SDK
> > >> <https://gitlab.com/shaktiproject/software/shakti-sdk>.
> > >>
> > >> I am porting to the Shakti line of MCU's, they are fully open-source
> > RISCV
> > >> based MCUs.
> > >>
> > >> I have followed the fairly short porting guide and have been trying to
> > use
> > >> the FE310 bsp implementation by SiFive as a template/guide since that
> is
> > >> also a RISCV board.
> > >>
> > >> My task as of now is to get UART working.
> > >>
> > >> Here are the directories I've added:
> > >> repos/apache-mynewt-core/hw/bsp/shakti_parashu/
> > >> ├── bsp.yml
> > >> ├── include
> > >> │   └── bsp
> > >> │       └── bsp.h
> > >> ├── parashu_boot.ld
> > >> ├── parashu.ld
> > >> ├── pkg.yml
> > >> ├── src
> > >> │   └── hal_bsp.c
> > >> └── syscfg.yml
> > >>
> > >> 3 directories, 7 files
> > >>
> > >> repos/apache-mynewt-core/hw/mcu/shakti/
> > >> ├── parashu
> > >> │   ├── include
> > >> │   │   ├── clint.h
> > >> │   │   ├── defines.h
> > >> │   │   ├── mcu
> > >> │   │   │   ├── parashu.h
> > >> │   │   │   ├── parashu_hal.h
> > >> │   │   │   ├── platform.h
> > >> │   │   │   └── sys_clock.h
> > >> │   │   ├── plic.h
> > >> │   │   └── traps.h
> > >> │   ├── pkg.yml
> > >> │   ├── src
> > >> │   │   ├── arch
> > >> │   │   │   └── rv32imacu
> > >> │   │   │       └── start.S
> > >> │   │   ├── clint.c
> > >> │   │   ├── hal_flash.c
> > >> │   │   ├── hal_os_tick.c
> > >> │   │   ├── hal_reset_cause.c
> > >> │   │   ├── hal_system.c
> > >> │   │   ├── hal_uart.c
> > >> │   │   ├── init.c
> > >> │   │   ├── plic.c
> > >> │   │   ├── sys_clock.c
> > >> │   │   └── traps.c
> > >> │   └── syscfg.yml
> > >> └── pkg.yml
> > >>
> > >> 6 directories, 22 files
> > >>
> > >> repos/apache-mynewt-core/kernel/os/src/arch/shakti/
> > >> ├── start.S
> > >> └── trap.S
> > >>
> > >> 0 directories, 2 files
> > >>
> > >> repos/apache-mynewt-core/compiler/riscv64-unknown-elf-shakti/
> > >> ├── compiler.yml
> > >> └── pkg.yml
> > >>
> > >> 0 directories, 2 files
> > >>
> > >> I forked the mynewt-core repo and uploaded my changes to the fork
> > >> <https://github.com/Keith-C-P/shakti-mynewt-core>.
> > >>
> > >> The code compiles, but the dump looks all wrong as major sections are
> > >> missing, like main and others
> > >>
> > >> I did compile mynewt for both native (linux) and for hifive1, i ran
> > >> hifive1
> > >> on a qemu vm as I don't have access to the actual board, but both
> worked
> > >> fine.
> > >>
> > >> I'll be honest I don't know what questions to ask as I am just
> starting
> > to
> > >> get into the embedded field and wanted a difficult project so I can
> > learn
> > >> fast.
> > >>
> > >> Any and all help would be greatly appreciated
> > >> Thanks in advance
> > >>
> > >> Regards,
> > >> Keith
> > >>
> > >
> >
>

Re: New MCU Porting Help

Posted by Keith P <ke...@gmail.com>.
Hi Jerzy,

The build tools are available here:
https://gitlab.com/shaktiproject/software/riscv-tools
The code is ran on an FPGA (Arty A7-100T), there is a qemu vm but it
doesn't work correctly.

I realised that the _start may already be defined while looking closer at
the Hifive1 startup code, I'll make those changes.
Is it possible that we can get on a call if you are free on the weekend?

Regards,
Keith

On Thu, Jun 26, 2025 at 3:49 PM Jerzy Kasenberg <je...@codecoup.pl>
wrote:

> Hi Keith,
>
> Your code defines _start as staring point and it also defines this
> function.
> This function initializes bss and calls init then it ends with busy loop.
>
> To make it link more code you could change your startup function to
> different name
> then after your init (or at the end of this function) you could call _start
> function that is present
> in baselib.c and that would start more mynewt code.
>
> Keep in mind that mynewt expect maynew_main function (not main) to be
> starting point of application.
>
> regards
> Jerzy
>
>
> czw., 26 cze 2025 o 10:18 Jerzy Kasenberg <je...@codecoup.pl>
> napisał(a):
>
> > Hi Keith,
> >
> > I did port of hifive1 few years back but I don't have setup ready.
> > Can you tell me what system you are using for development and how to get
> > build tools you have?
> > If I can setup environment again I'm pretty sure we can make this work.
> > Originally compiler used for HiFive1 board was downloaded from SiFive
> site
> > I don't know
> > it this is the one you are using and if the one I used is still there
> >
> > regards
> > Jerzy
> >
> >
> > śr., 25 cze 2025 o 09:37 Keith P <ke...@gmail.com> napisał(a):
> >
> >> Hello everyone,
> >>
> >> I am an intern at a lab and don't really get how to continue with
> porting,
> >> I have made a few files and copied some code from the mcu's original SDK
> >> <https://gitlab.com/shaktiproject/software/shakti-sdk>.
> >>
> >> I am porting to the Shakti line of MCU's, they are fully open-source
> RISCV
> >> based MCUs.
> >>
> >> I have followed the fairly short porting guide and have been trying to
> use
> >> the FE310 bsp implementation by SiFive as a template/guide since that is
> >> also a RISCV board.
> >>
> >> My task as of now is to get UART working.
> >>
> >> Here are the directories I've added:
> >> repos/apache-mynewt-core/hw/bsp/shakti_parashu/
> >> ├── bsp.yml
> >> ├── include
> >> │   └── bsp
> >> │       └── bsp.h
> >> ├── parashu_boot.ld
> >> ├── parashu.ld
> >> ├── pkg.yml
> >> ├── src
> >> │   └── hal_bsp.c
> >> └── syscfg.yml
> >>
> >> 3 directories, 7 files
> >>
> >> repos/apache-mynewt-core/hw/mcu/shakti/
> >> ├── parashu
> >> │   ├── include
> >> │   │   ├── clint.h
> >> │   │   ├── defines.h
> >> │   │   ├── mcu
> >> │   │   │   ├── parashu.h
> >> │   │   │   ├── parashu_hal.h
> >> │   │   │   ├── platform.h
> >> │   │   │   └── sys_clock.h
> >> │   │   ├── plic.h
> >> │   │   └── traps.h
> >> │   ├── pkg.yml
> >> │   ├── src
> >> │   │   ├── arch
> >> │   │   │   └── rv32imacu
> >> │   │   │       └── start.S
> >> │   │   ├── clint.c
> >> │   │   ├── hal_flash.c
> >> │   │   ├── hal_os_tick.c
> >> │   │   ├── hal_reset_cause.c
> >> │   │   ├── hal_system.c
> >> │   │   ├── hal_uart.c
> >> │   │   ├── init.c
> >> │   │   ├── plic.c
> >> │   │   ├── sys_clock.c
> >> │   │   └── traps.c
> >> │   └── syscfg.yml
> >> └── pkg.yml
> >>
> >> 6 directories, 22 files
> >>
> >> repos/apache-mynewt-core/kernel/os/src/arch/shakti/
> >> ├── start.S
> >> └── trap.S
> >>
> >> 0 directories, 2 files
> >>
> >> repos/apache-mynewt-core/compiler/riscv64-unknown-elf-shakti/
> >> ├── compiler.yml
> >> └── pkg.yml
> >>
> >> 0 directories, 2 files
> >>
> >> I forked the mynewt-core repo and uploaded my changes to the fork
> >> <https://github.com/Keith-C-P/shakti-mynewt-core>.
> >>
> >> The code compiles, but the dump looks all wrong as major sections are
> >> missing, like main and others
> >>
> >> I did compile mynewt for both native (linux) and for hifive1, i ran
> >> hifive1
> >> on a qemu vm as I don't have access to the actual board, but both worked
> >> fine.
> >>
> >> I'll be honest I don't know what questions to ask as I am just starting
> to
> >> get into the embedded field and wanted a difficult project so I can
> learn
> >> fast.
> >>
> >> Any and all help would be greatly appreciated
> >> Thanks in advance
> >>
> >> Regards,
> >> Keith
> >>
> >
>

Re: New MCU Porting Help

Posted by Jerzy Kasenberg <je...@codecoup.pl>.
Hi Keith,

Your code defines _start as staring point and it also defines this function.
This function initializes bss and calls init then it ends with busy loop.

To make it link more code you could change your startup function to
different name
then after your init (or at the end of this function) you could call _start
function that is present
in baselib.c and that would start more mynewt code.

Keep in mind that mynewt expect maynew_main function (not main) to be
starting point of application.

regards
Jerzy


czw., 26 cze 2025 o 10:18 Jerzy Kasenberg <je...@codecoup.pl>
napisał(a):

> Hi Keith,
>
> I did port of hifive1 few years back but I don't have setup ready.
> Can you tell me what system you are using for development and how to get
> build tools you have?
> If I can setup environment again I'm pretty sure we can make this work.
> Originally compiler used for HiFive1 board was downloaded from SiFive site
> I don't know
> it this is the one you are using and if the one I used is still there
>
> regards
> Jerzy
>
>
> śr., 25 cze 2025 o 09:37 Keith P <ke...@gmail.com> napisał(a):
>
>> Hello everyone,
>>
>> I am an intern at a lab and don't really get how to continue with porting,
>> I have made a few files and copied some code from the mcu's original SDK
>> <https://gitlab.com/shaktiproject/software/shakti-sdk>.
>>
>> I am porting to the Shakti line of MCU's, they are fully open-source RISCV
>> based MCUs.
>>
>> I have followed the fairly short porting guide and have been trying to use
>> the FE310 bsp implementation by SiFive as a template/guide since that is
>> also a RISCV board.
>>
>> My task as of now is to get UART working.
>>
>> Here are the directories I've added:
>> repos/apache-mynewt-core/hw/bsp/shakti_parashu/
>> ├── bsp.yml
>> ├── include
>> │   └── bsp
>> │       └── bsp.h
>> ├── parashu_boot.ld
>> ├── parashu.ld
>> ├── pkg.yml
>> ├── src
>> │   └── hal_bsp.c
>> └── syscfg.yml
>>
>> 3 directories, 7 files
>>
>> repos/apache-mynewt-core/hw/mcu/shakti/
>> ├── parashu
>> │   ├── include
>> │   │   ├── clint.h
>> │   │   ├── defines.h
>> │   │   ├── mcu
>> │   │   │   ├── parashu.h
>> │   │   │   ├── parashu_hal.h
>> │   │   │   ├── platform.h
>> │   │   │   └── sys_clock.h
>> │   │   ├── plic.h
>> │   │   └── traps.h
>> │   ├── pkg.yml
>> │   ├── src
>> │   │   ├── arch
>> │   │   │   └── rv32imacu
>> │   │   │       └── start.S
>> │   │   ├── clint.c
>> │   │   ├── hal_flash.c
>> │   │   ├── hal_os_tick.c
>> │   │   ├── hal_reset_cause.c
>> │   │   ├── hal_system.c
>> │   │   ├── hal_uart.c
>> │   │   ├── init.c
>> │   │   ├── plic.c
>> │   │   ├── sys_clock.c
>> │   │   └── traps.c
>> │   └── syscfg.yml
>> └── pkg.yml
>>
>> 6 directories, 22 files
>>
>> repos/apache-mynewt-core/kernel/os/src/arch/shakti/
>> ├── start.S
>> └── trap.S
>>
>> 0 directories, 2 files
>>
>> repos/apache-mynewt-core/compiler/riscv64-unknown-elf-shakti/
>> ├── compiler.yml
>> └── pkg.yml
>>
>> 0 directories, 2 files
>>
>> I forked the mynewt-core repo and uploaded my changes to the fork
>> <https://github.com/Keith-C-P/shakti-mynewt-core>.
>>
>> The code compiles, but the dump looks all wrong as major sections are
>> missing, like main and others
>>
>> I did compile mynewt for both native (linux) and for hifive1, i ran
>> hifive1
>> on a qemu vm as I don't have access to the actual board, but both worked
>> fine.
>>
>> I'll be honest I don't know what questions to ask as I am just starting to
>> get into the embedded field and wanted a difficult project so I can learn
>> fast.
>>
>> Any and all help would be greatly appreciated
>> Thanks in advance
>>
>> Regards,
>> Keith
>>
>

Re: New MCU Porting Help

Posted by Jerzy Kasenberg <je...@codecoup.pl>.
Hi Keith,

I did port of hifive1 few years back but I don't have setup ready.
Can you tell me what system you are using for development and how to get
build tools you have?
If I can setup environment again I'm pretty sure we can make this work.
Originally compiler used for HiFive1 board was downloaded from SiFive site
I don't know
it this is the one you are using and if the one I used is still there

regards
Jerzy


śr., 25 cze 2025 o 09:37 Keith P <ke...@gmail.com> napisał(a):

> Hello everyone,
>
> I am an intern at a lab and don't really get how to continue with porting,
> I have made a few files and copied some code from the mcu's original SDK
> <https://gitlab.com/shaktiproject/software/shakti-sdk>.
>
> I am porting to the Shakti line of MCU's, they are fully open-source RISCV
> based MCUs.
>
> I have followed the fairly short porting guide and have been trying to use
> the FE310 bsp implementation by SiFive as a template/guide since that is
> also a RISCV board.
>
> My task as of now is to get UART working.
>
> Here are the directories I've added:
> repos/apache-mynewt-core/hw/bsp/shakti_parashu/
> ├── bsp.yml
> ├── include
> │   └── bsp
> │       └── bsp.h
> ├── parashu_boot.ld
> ├── parashu.ld
> ├── pkg.yml
> ├── src
> │   └── hal_bsp.c
> └── syscfg.yml
>
> 3 directories, 7 files
>
> repos/apache-mynewt-core/hw/mcu/shakti/
> ├── parashu
> │   ├── include
> │   │   ├── clint.h
> │   │   ├── defines.h
> │   │   ├── mcu
> │   │   │   ├── parashu.h
> │   │   │   ├── parashu_hal.h
> │   │   │   ├── platform.h
> │   │   │   └── sys_clock.h
> │   │   ├── plic.h
> │   │   └── traps.h
> │   ├── pkg.yml
> │   ├── src
> │   │   ├── arch
> │   │   │   └── rv32imacu
> │   │   │       └── start.S
> │   │   ├── clint.c
> │   │   ├── hal_flash.c
> │   │   ├── hal_os_tick.c
> │   │   ├── hal_reset_cause.c
> │   │   ├── hal_system.c
> │   │   ├── hal_uart.c
> │   │   ├── init.c
> │   │   ├── plic.c
> │   │   ├── sys_clock.c
> │   │   └── traps.c
> │   └── syscfg.yml
> └── pkg.yml
>
> 6 directories, 22 files
>
> repos/apache-mynewt-core/kernel/os/src/arch/shakti/
> ├── start.S
> └── trap.S
>
> 0 directories, 2 files
>
> repos/apache-mynewt-core/compiler/riscv64-unknown-elf-shakti/
> ├── compiler.yml
> └── pkg.yml
>
> 0 directories, 2 files
>
> I forked the mynewt-core repo and uploaded my changes to the fork
> <https://github.com/Keith-C-P/shakti-mynewt-core>.
>
> The code compiles, but the dump looks all wrong as major sections are
> missing, like main and others
>
> I did compile mynewt for both native (linux) and for hifive1, i ran hifive1
> on a qemu vm as I don't have access to the actual board, but both worked
> fine.
>
> I'll be honest I don't know what questions to ask as I am just starting to
> get into the embedded field and wanted a difficult project so I can learn
> fast.
>
> Any and all help would be greatly appreciated
> Thanks in advance
>
> Regards,
> Keith
>