s-macke / jor1k

Online OR1K Emulator running Linux
http://jor1k.com
BSD 2-Clause "Simplified" License
1.74k stars 198 forks source link

pthread lib is missing #10

Closed angrave closed 9 years ago

angrave commented 10 years ago

The link library for pthreads is missing from the gcc image hdgcc.bz2 Steps to reproduce: gcc -pthread hello.c

s-macke commented 10 years ago

Yes, I tried to make the hdd images as small as possible. Even nowadays 10MB for a website is pretty huge and for several reasons I included only the absolute minimum in order to compile only the provided examples. That means, that I copied file by file until all provided example worked.

It is no problem to provide you with an improved image, thats include every library you want. For now, you can try downloading simulationcorner.net/hdgcc.bz2. I have implemented the pthread library, but not tested yet.

angrave commented 10 years ago

Yes this 'works' - Thankyou! This is awesome. I can compile and run pthread'd programs. The simple pthread 'hello-world' example worked fine.

https://computing.llnl.gov/tutorials/pthreads/samples/hello.c (just add '-pthread' to the fake-typed gcc command)

Let me know if you'd like pull request with your new disk image and lightly modified compile-demo that includes "gcc -pthread"

Unfortunately the UART fake-typing trick fails if the program is too long. It failed if the terminal echoed a program longer than 12 full lines of 80 chars and 2/3rd of a full line. 12*80 + 64 = 1024; haha! so I presume linux @ openrisk has a buffer of 1024 characters that can overflow... A discussion about a 'flip buffer' is here ... http://www.linuxmisc.com/16-linux-development/27067d90131004e8.htm (It's also possible that the uart device doesn't properly throw the right interrupt at the right time every time). I could slow the generation of fake characters down until I see the characters appear in the output terminal.Or perhaps Linux sends a "I'm full please pause / please resume") message to the UART?

s-macke commented 10 years ago

Nice, that it works. Please don't send pull requests for the disk images. Every time I update the image the repository increases by 10MB. First let us check if anything else is missing. Then I will update the image.

I have realized the problem with the uart too. Instead of "echo" I wanted to use "cat > proc.c" and it didn't work. So far I have not found the real error yet. One solution would be, that we wait until the sign is echoed. I try to investigate. The uart has an built-in fifo, but I didn't implement it.

angrave commented 10 years ago

On 6/21/14 12:16 AM, Sebastian Macke wrote:

Nice, that it works.

Yes - it's awesome. I intend to create a version of the pthread tutorial https://computing.llnl.gov/tutorials/pthreads/ -with a live examples.

Eventually I might replace the textarea with the syntax-highlighting ace editor. Would also be nice to tie in gcc error messages with the editor too.

Please don't send pull requests for the disk images. Every time I update the image the repository increases by 10MB. First let us check if anything else is missing. Then I will update the image.

OK.

I have realized the problem with the uart too. Instead of "echo" I wanted to use "cat > proc.c" and it didn't work. So far I have not found the real error yet. One solution would be, that we wait until the sign is echoed. I try to investigate.

Yes. that would be cool. We need to send CTRL-C (to interrupt an infinite loop or gcc from an existing prog compile and run) and CTRL-D (to finish the cat) but I couldn't get it to work. Good luck on your investigations.

The uart has an built-in fifo, but I didn't implement it.

Yes, that's the fifo I implemented in the original pull request that you recently merged. uarts typically implement a short fifo (16 chars) and short-timeout.But for jor1k it's OK to have a larger buffer. We're dropping chars after 1024 because Linux has an internal buffer. I believe Linux sends a RTS and CTS signals to the UART when its buffer is full but haven't investigated exactly how it sends this to the UART but will look tonight. My plan is as we get start/stop requests we just temporariliy stop sending the char-ready/timeout interrupts.

http://www.tldp.org/HOWTO/Serial-HOWTO.html#toc19.4

FYI I will eventually create an O(1) growable circular buffer fifo class in utility.js and use that instead of my simple javascript array but

O(N) implementation.

Q. Do you think it's easy to have two uarts? (One for internal use, one

for the user terminal)?

Useful Features... I think reducing power on idle (and lowering the duty-cycle when not-in-focus) would be useful - right now jor1k it's a laptop battery

eater:-)

Re Large Disks Image. An FYI for the future ...

By the way, I used BrowserFS in a java-in-the-browser project: http://www.codemoo.com (there's a game and also a free-form interpretted Java interface and free-form book with live examples) A feature of BrowserFS is pull-on-demand; it can request individual files from a server when they are opened or stat'd. Afterwards they are cached in LocalStorage. In addition to the on-demand files, the required startup files are preloaded in a tar image. This means students can play with just about the entire JDK without having to load all of it and the startup time is reasonable.

Best, Lawrence.

— Reply to this email directly or view it on GitHub https://github.com/s-macke/jor1k/issues/10#issuecomment-46744964.

regular commented 9 years ago

Is the UART problem solved by now?

s-macke commented 9 years ago

Yes, the problem was solved a long time ago by me. Actually almost everything important has changed since this issue.

benjamincburns commented 9 years ago

@s-macke - Probably another one that can be closed?

Also re: 10MB binary files, this announcement from GitHub seems relevant.

s-macke commented 9 years ago

Yes, this issue can be closed