Skip to content
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

Cannot upload neorv32_exe.bin for demo CFS on NexysA7 #781

Closed
JC-LL opened this issue Jan 30, 2024 · 10 comments
Closed

Cannot upload neorv32_exe.bin for demo CFS on NexysA7 #781

JC-LL opened this issue Jan 30, 2024 · 10 comments
Labels
troubleshooting Something is not working as expected

Comments

@JC-LL
Copy link

JC-LL commented Jan 30, 2024

Describe the bug
cannot upload neorv32_exe.bin for demo CFS with nexys-a7-test-setup. The upload process freezes

To Reproduce
Switch IO_CFS_EN=true in neorv32_top.vhd then restart synthesis :
cd neorv32-setups/vivado/nexys-a7-test-setup/
vivado -mode tcl -source create_project.tcl # and push bitstream
cd neorv32/sw/example/demo_cfs
make exe
run neo on FPGA and interrupt the boot process to 'u'pload neorv32_exe.bin (me : using gtkterm or minicom)
the process freezes

Expected behavior
The upload should finish.

Screenshots
image

@umarcor
Copy link
Collaborator

umarcor commented Jan 30, 2024

FTR, we are also having issues with the bootloader on an Arty-A7. For now, we are disabling the bootloader so that the app is started straightaway. However, that requires resynthesising if we want to change the software.

/cc @Unike267

@stnolting
Copy link
Owner

stnolting commented Jan 30, 2024

Hey @JC-LL!

Hmm this problem sounds familiar...

Does the upload only freeze when you upload your specific program? Can you try compiling a simpler one (e.g. sw/example/hello_world) and try uploading that?

I guess your executable is larger than 4kB, which is a known problem with GTKTerm: #215 (comment)

Can you try a different terminal program like cutecom or picocom?

@umarcor

Which terminal program are you using?

@stnolting stnolting added the troubleshooting Something is not working as expected label Jan 30, 2024
@JC-LL
Copy link
Author

JC-LL commented Jan 30, 2024

Hello @stnolting !

First, congrats for this interesting project.

Yes, smaller binary programs run fine, like the LED demo provided, that works like a charm.

Gtkterm is the issue here. However, I'v just tried picocom, that also seem to freeze (I hope I have used it correctly for sending the code). On my Linux Mint, cutecom does not seem to simply react when booting Neorv32...

I'm still investigating.

Update :
Ok, cutcom now reacts, but gives this :

CMD:> u
Awaiting neorv32_exe.bin... <0x07>
ERR_EXE

@stnolting
Copy link
Owner

First, congrats for this interesting project.

Thank you very much! :)

I'v just tried picocom, that also seem to freeze (I hope I have used it correctly for sending the code). On my Linux Mint, cutecom does not seem to simply react when booting Neorv32...

Have you tried this one? (from #215 (comment))
$ sudo picocom /dev/ttyUSBx -b 19200 --send-cmd="ascii-xfr -s -n"

Ok, cutcom now reacts, but gives this : [...] ERR_EXE

This is a signature error, so the first 4 bytes are not the expected ones:

/**********************************************************************//**
* Valid executable identification signature
**************************************************************************/
#define EXE_SIGNATURE 0x4788CAFE

Are you uploading the right executable file (neorv32_exe.bin and not main.bin)?

@JC-LL
Copy link
Author

JC-LL commented Jan 30, 2024

Things are a bit weird. My first attempt with picocom (with the correct neorv32_exe.bin) went wrong...

I just retried, and I finally managed to upload the executable. Hurray !

Well...not perfect still.

CMD:> u
Awaiting neorv32_exe.bin... 
*** file: /home/jcll/JCLL/exp/neorv32/sw/example/demo_cfs/neorv32_exe.bin
$ ascii-xfr -s -n /home/jcll/JCLL/exp/neorv32/sw/example/demo_cfs/neorv32_exe.bin
ASCII upload of "/home/jcll/JCLL/exp/neorv32/sw/example/demo_cfs/neorv32_exe.bin"

*** exit status: 0 ***
OK
CMD:> e
Booting from 0x00000000...

Error! No CFS synthesized!

@stnolting
Copy link
Owner

I just retried, and I finally managed to upload the executable. Hurray !

Great to hear! 🎉

Well...not perfect still. [...] Error! No CFS synthesized!

Seems like the CFS was not enabled before synthesizing. You need to set the according configuration generic to "true" in your instance of the processor:

IO_CFS_EN : boolean := false; -- implement custom functions subsystem (CFS)?

@JC-LL
Copy link
Author

JC-LL commented Jan 30, 2024

That surprised me much because, IO_CFS_EN was indeed correctly set to true...That was my initial goal ! I probably made a mistake renaming bitstream. I'll try again tomorrow.

Update : "Tomorrow will soon come" (new James Bond film ?)

It works. It seems that modifying generic definition (which I did) is not sufficient. I don't see why. It really needs to be set in the generic map, while instanciating neorv32_top in neorv32_test_setup_bootloader.vhd. Better practice for sure, but weird that it didn't work at first try.

For completeness, here is the uart log :

CMD:> u
Awaiting neorv32_exe.bin... 
*** file: /home/jcll/JCLL/exp/neorv32/sw/example/demo_cfs/neorv32_exe.bin
$ ascii-xfr -s -n /home/jcll/JCLL/exp/neorv32/sw/example/demo_cfs/neorv32_exe.bin
ASCII upload of "/home/jcll/JCLL/exp/neorv32/sw/example/demo_cfs/neorv32_exe.bin"


*** exit status: 0 ***
OK
CMD:> e
Booting from 0x00000000...

<<< NEORV32 Custom Functions Subsystem (CFS) Demo Program >>>

NOTE: This program assumes the _default_ CFS hardware module, which implements
      simple data conversion functions using four memory-mapped registers.

Default CFS memory-mapped registers:
 * NEORV32_CFS->REG[0] (r/w): convert binary to gray code
 * NEORV32_CFS->REG[1] (r/w): convert gray to binary code
 * NEORV32_CFS->REG[2] (r/w): bit reversal
 * NEORV32_CFS->REG[3] (r/w): byte swap
The remaining 60 CFS registers are unused and will return 0 when read.

--- CFS 'binary to gray' function ---
0: IN = 0xb11ddc17, OUT = 0xe993321c
1: IN = 0x59781258, OUT = 0x75c41b74
2: IN = 0x3d54c7e1, OUT = 0x23fea411
3: IN = 0x10be1395, OUT = 0x18e11a5f

--- CFS 'gray to binary' function ---
0: IN = 0x8b578493, OUT = 0xf265071d
1: IN = 0x037ef751, OUT = 0x0254a59e
2: IN = 0x6f038afb, OUT = 0x4a02f352
3: IN = 0xd5c05f75, OUT = 0x997f95a6

--- CFS 'bit reversal' function ---
0: IN = 0x1bfc9c22, OUT = 0x44393fd8
1: IN = 0x876b9bde, OUT = 0x7bd9d6e1
2: IN = 0x76141b16, OUT = 0x68d8286e
3: IN = 0x5ba2940d, OUT = 0xb02945da

--- CFS 'byte swap' function ---
0: IN = 0x2d45231c, OUT = 0x1c23452d
1: IN = 0xadfa166f, OUT = 0x6f16faad
2: IN = 0x09c7bf74, OUT = 0x74bfc709
3: IN = 0x3b014c60, OUT = 0x604c013b

CFS demo program completed.

@stnolting
Copy link
Owner

It works. It seems that modifying generic definition (which I did) is not sufficient. I don't see why. It really needs to be set in the generic map

Right, the instantiation will override the defaults from the entity declaration.

For completeness, here is the uart log

👍 🚀

@Unike267
Copy link
Contributor

Unike267 commented Feb 5, 2024

Hi @stnolting

Which terminal program are you using?

We are using cutecom terminal. The problem was that the type of file that we set in cutecom was Script and if you set this type the cutecom responds with ERR_EXE.

So to fix it you must set Plain type. As shown in the following image:

upload_ok_issue

/cc @umarcor

@stnolting
Copy link
Owner

Thanks for the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
troubleshooting Something is not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants