RISCV-on-Microsemi-FPGA / RTG4-Development-Kit

Sample RISC-V Libero projects for the RTG4 Development Kit
5 stars 7 forks source link

Added SPI to Single Core Design and it hangs in SoftConsole #10

Open salmansheikh opened 5 years ago

salmansheikh commented 5 years ago

I only added a single CoreSPI to the Single Processor design, it compiled, placed and routed (I even assigned pins to the SPI signals). Programmed the board and when I try to start the debugger, I can't get anything to work. It hangs with a msg. Is there something that I did wrong in h/w or SoftConsole that would give this error. I've been fighting this for a week with no clue what is wrong and why it doesn't even enter debug like the normal pre-built FPGA image for a single core.

Attached is what SoftConsole says when I try to run debug to test my core. Or even if I try running even the blinky program (which should still work since its just adding an SPI core). Nothing runs on this version.

error_on_debug

salmansheikh commented 5 years ago

Normally, i should see a bunch of register values in the debugger when I run the pre-built FPGA image for the RTG4 . How are those normally printed? Is that a openocd command that prints those? It gives an error that I can't even get a google answer for what E0E means.

salmansheikh commented 5 years ago

Here is my smartdesign. Its only different from the base design by the addition of the CoreSPI to CoreAPB3 bus and some output pins for SPI.

added_spi.pdf

CLappin commented 5 years ago

Hi,

Could you try updating the RISCV hal to version 2.2.103 from Firmware Catalog, it's under RISC-V Hardware Abstraction Layer (HAL), as the project you generated was for SoftConsole v5.2.

If this does not work, could you send me a link to your Libero project and I'll take a look at it.

Thanks, Ciaran

salmansheikh commented 5 years ago

Is this done in SoftConsole?

salmansheikh commented 5 years ago

How do I generate a hw_platform.h? Or what tool does that?

CLappin commented 5 years ago

Yes, the riscv hal is generated in Firmware Catalog which comes with Libero SoC v11.9. The riscv hal is then replaced in the example firmware project that you generated from the firmware catalog before.

The hw_platform.h can be taken from one of the example projects in SoftConsole v5.3. If I remember correctly there should be a sample hw_platform.h file in the riscv hal. Depending on your design you may need to update the hw_platform.h file to match your design. For example, the example hw_platform.h file has the UART at 0x70001000 your design may have it at 0x6000F000, you would have to change the define related to the UART so it matches your design.

salmansheikh commented 5 years ago

It built but still having the same issue in the debugger.

17:53:37 Build of configuration Debug for project miv-rv32im make all Building file: ../src/main.c Invoking: GNU RISC-V Cross C Compiler riscv64-unknown-elf-gcc -march=rv32im -mabi=ilp32 -msmall-data-limit=8 -O2 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -I"C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im\drivers\CoreGPIO" -I"C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im" -I"C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im\drivers\CoreSPI" -I"C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im\drivers\CoreUARTapb" -I"C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im\hal" -I"C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im\riscv_hal" -std=gnu11 -MMD -MP -MF"src/main.d" -MT"src/main.o" -c -o "src/main.o" "../src/main.c" Finished building: ../src/main.c

Building target: miv-rv32im.elf Invoking: GNU RISC-V Cross C Linker riscv64-unknown-elf-gcc -march=rv32im -mabi=ilp32 -msmall-data-limit=8 -O2 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -T "C:\Users\ssheikh\Documents\SoftConsole2\miv-rv32im\riscv_hal\microsemi-riscv-ram.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,"miv-rv32im.map" --specs=nano.specs -o "miv-rv32im.elf" ./src/main.o
c:/microsemi/softconsole_v5.3/riscv-unknown-elf-gcc/bin/../lib/gcc/riscv64-unknown-elf/7.2.0/../../../../riscv64-unknown-elf/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 0000000080000000 Finished building target: miv-rv32im.elf

I can't attach the zip file. Its 117MB for the Libero project.

salmansheikh commented 5 years ago

The link to the project file is here.

https://www.dropbox.com/s/a4ykfqzuc1g3ik5/MIV_RV32IMA_BaseDesign_vlog.zip?dl=0

And here is the softconsole zip file:

https://www.dropbox.com/s/xzm1it82fuvbbex/spi_workspace.zip?dl=0

salmansheikh commented 5 years ago

okay, I found one thing my clock should be 100MHz not 50MHz for system in hw_platform.h since that is the GL0 going to the other blocks. How do I know what my address is for my components? I don't see any memory map file generated by SmartDesign or LiberoSOC. Also I keep getting a warning about the _start and the address 80000000 is the default.

c:/microsemi/softconsole_v5.3/riscv-unknown-elf-gcc/bin/../lib/gcc/riscv64-unknown-elf/7.2.0/../../../../riscv64-unknown-elf/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 0000000080000000

Is this supposed to be the reset address. From Libero this value is 80808080. How can I change it to that in softconsole? reset

CLappin commented 5 years ago

Hi ,

I have had a look at your Libero project and have noticed the following: 1) the design is attempting to run at 100Mhz, this is not possible with this MIV core. I reduced the frequency to 50Mhz and I was able to run the example firmware supplied with SoftConsole 5.3. Please refer to the MIV_RV32IMA_L1_AHB Usage Table for a list of operating frequencies.

2) The MIV_RV32IMA_L1_AHB core that you are using has an issue with the reset, this can be fixed by reverting to the MIV_RV32IMA_L1_AHB v2.0.100 or by applying the following fix to the miv_rv32ima_l1_ahb_async_reset_reg.v file. Find the always@ block and change it to read always@(posedge clk or posedge rst) begin. This issue has been flagged and there will be a fix released in the coming weeks.

3) I suggest using a reset vector of the MIV to 0x8000_0000.

I haven't had a chance to look at your firmware.

Please attempt these fixes and let me know if you can get a debug session going.

salmansheikh commented 5 years ago

Okay, I got the frequency back to 50MHz and its not hanging up with errors but I do get this msg and I am sure its related to number 2. I already did

3 with the reset vector before seeing your post. So, where do I find the

miv_rv32ima_I1_ahb_sync_reset_reg.v file? Is that in the core directory?

Salman

On Wed, Nov 21, 2018 at 9:33 AM CLappin notifications@github.com wrote:

Hi ,

I have had a look at your Libero project and have noticed the following:

1.

the design is attempting to run at 100Mhz, this is not possible with this MIV core. I reduced the frequency to 50Mhz and I was able to run the example firmware supplied with SoftConsole 5.3. Please refer to the MIV_RV32IMA_L1_AHB Usage Table for a list of operating frequencies. 2.

The MIV_RV32IMA_L1_AHB core that you are using has an issue with the reset, this can be fixed by reverting to the MIV_RV32IMA_L1_AHB v2.0.100 or by applying the following fix to the miv_rv32ima_l1_ahb_async_reset_reg.v file. Find the always@ block and change it to read always@(posedge clk or posedge rst) begin. This issue has been flagged and there will be a fix released in the coming weeks. 3.

I suggest using a reset vector of the MIV to 0x8000_0000.

I haven't had a chance to look at your firmware.

Please attempt these fixes and let me know if you can get a debug session going.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RISCV-on-Microsemi-FPGA/RTG4-Development-Kit/issues/10#issuecomment-440682433, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJcMJPrZHO_nBfuMPB2mDhp50lPKwLXks5uxWQ-gaJpZM4YqAdF .

-- Even a Smile is charity :)

salmansheikh commented 5 years ago

okay, I found it. I edited the file. I will try rebuilding my project.

On Mon, Nov 26, 2018 at 12:19 PM Salman Sheikh salmanisheikh@gmail.com wrote:

Okay, I got the frequency back to 50MHz and its not hanging up with errors but I do get this msg and I am sure its related to number 2. I already did

3 with the reset vector before seeing your post. So, where do I find the

miv_rv32ima_I1_ahb_sync_reset_reg.v file? Is that in the core directory?

Salman

On Wed, Nov 21, 2018 at 9:33 AM CLappin notifications@github.com wrote:

Hi ,

I have had a look at your Libero project and have noticed the following:

1.

the design is attempting to run at 100Mhz, this is not possible with this MIV core. I reduced the frequency to 50Mhz and I was able to run the example firmware supplied with SoftConsole 5.3. Please refer to the MIV_RV32IMA_L1_AHB Usage Table for a list of operating frequencies. 2.

The MIV_RV32IMA_L1_AHB core that you are using has an issue with the reset, this can be fixed by reverting to the MIV_RV32IMA_L1_AHB v2.0.100 or by applying the following fix to the miv_rv32ima_l1_ahb_async_reset_reg.v file. Find the always@ block and change it to read always@(posedge clk or posedge rst) begin. This issue has been flagged and there will be a fix released in the coming weeks. 3.

I suggest using a reset vector of the MIV to 0x8000_0000.

I haven't had a chance to look at your firmware.

Please attempt these fixes and let me know if you can get a debug session going.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RISCV-on-Microsemi-FPGA/RTG4-Development-Kit/issues/10#issuecomment-440682433, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJcMJPrZHO_nBfuMPB2mDhp50lPKwLXks5uxWQ-gaJpZM4YqAdF .

-- Even a Smile is charity :)

  • Prophet Muhammad

-- Even a Smile is charity :)

salmansheikh commented 5 years ago

Sometimes when killing the run session and starting it again, I get this behavior. The only way I know to fix it is to recycle the board power. Why does this msg happen?

On Mon, Nov 26, 2018 at 12:27 PM Salman Sheikh salmanisheikh@gmail.com wrote:

okay, I found it. I edited the file. I will try rebuilding my project.

On Mon, Nov 26, 2018 at 12:19 PM Salman Sheikh salmanisheikh@gmail.com wrote:

Okay, I got the frequency back to 50MHz and its not hanging up with errors but I do get this msg and I am sure its related to number 2. I already did #3 with the reset vector before seeing your post. So, where do I find the miv_rv32ima_I1_ahb_sync_reset_reg.v file? Is that in the core directory?

Salman

On Wed, Nov 21, 2018 at 9:33 AM CLappin notifications@github.com wrote:

Hi ,

I have had a look at your Libero project and have noticed the following:

1.

the design is attempting to run at 100Mhz, this is not possible with this MIV core. I reduced the frequency to 50Mhz and I was able to run the example firmware supplied with SoftConsole 5.3. Please refer to the MIV_RV32IMA_L1_AHB Usage Table for a list of operating frequencies. 2.

The MIV_RV32IMA_L1_AHB core that you are using has an issue with the reset, this can be fixed by reverting to the MIV_RV32IMA_L1_AHB v2.0.100 or by applying the following fix to the miv_rv32ima_l1_ahb_async_reset_reg.v file. Find the always@ block and change it to read always@(posedge clk or posedge rst) begin. This issue has been flagged and there will be a fix released in the coming weeks. 3.

I suggest using a reset vector of the MIV to 0x8000_0000.

I haven't had a chance to look at your firmware.

Please attempt these fixes and let me know if you can get a debug session going.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RISCV-on-Microsemi-FPGA/RTG4-Development-Kit/issues/10#issuecomment-440682433, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJcMJPrZHO_nBfuMPB2mDhp50lPKwLXks5uxWQ-gaJpZM4YqAdF .

-- Even a Smile is charity :)

  • Prophet Muhammad

-- Even a Smile is charity :)

  • Prophet Muhammad

-- Even a Smile is charity :)

CLappin commented 5 years ago

Hi,

which message are you referring to? There is a known issue stated in the Hand Book for the MiV cores ( section 10.1 ) that says you've to reset/power cycle the board between debug sessions sometimes.

salmansheikh commented 5 years ago

I saw that. Why is that? And I guess there is a way to assign one of the buttons on the board to do the same thing? Its not really helpful when I am remotely working on the board (teleworking) and I need to ask an office mate to go to the lab and recycle the power. The other option is to put a relay of some sort to remotely turn on the AC adapter to the board.

On Wed, Nov 28, 2018 at 4:36 AM CLappin notifications@github.com wrote:

Hi,

which message are you referring to? There is a known issue stated in the Hand Book for the MiV cores ( section 10.1 ) that says you've to reset/power cycle the board between debug sessions sometimes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RISCV-on-Microsemi-FPGA/RTG4-Development-Kit/issues/10#issuecomment-442381619, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJcMA1yYWf9PIuGrQH-Li096f2_LA5_ks5uzlkrgaJpZM4YqAdF .

-- Even a Smile is charity :)