I would like to get into the field of FPGAs a bit. I currently have a PolarFire Everest Dev Board and would like to try something small on it for testing purposes. My current level is very low, i.e. complete beginner. My first working project was a counter that counts binary to 15 and outputs it via the LEDs of the board. Now I wanted to play with RISC-V. Unfortunately I can't find anything on the internet that meets my expectations and almost nothing is "beginner friendly". My current goal is actually just to implement something on the level of a Hello World program in C via the SoftConsole. Unfortunately I have no idea how to go about it. Can anyone help me or recommend a good entry on the internet? Most of the stuff is either unusable, requires licenses I can't get, or is simply no longer available (which happens to me quite often with PDFs from Microsemi).
Since I don't really know what I could do with it to start with, I don't have any code yet that I would like to include. The plan would actually be to create something where I also get feedback via the board that something has been done. Later when I have more understanding SRAMs should be managed with it.
Related
So, I'm wondering if there's a way that I could have a program run in c, and when it finishes, to call and run a second program right after.
Basically, this is for a text-adventure thing, and I'd like it to run in segments, partly so that the code doesn't get huge with a ton if if-statements and all that, and partly so that I can have like a faux checkpoint system so that you can pick up sorta where you left off.
That, or a way to save your progress somehow. I couldn't come up with anything on exactly how to do that, but I know it's possible. I just don't really know what I'm doing yet. Forgive me if the above question(s) are really simple.
I am scripting maps for the game Homeworld 2, the original NOT remastered (since I don't have and can't get remastered).
Problem is, I'm getting an error in the script somewhere, which I'm pretty sure is a syntax error because it makes the game crash before the main menu (from experience other error types usually cause a crash at the time the map loads).
I have tried using codepad.org and checked out other similar sites, but they don't let you choose lua version 4 (which is what Homeworld 2 uses), so I can only assume they use lua 5, which means their utility is rather limited. Codepad said my code was good despite this.
I have skimmed the lua 4 documentation, but honestly I have no idea what I'm looking for.
Thus far, my programming experience is c++, and the little bit of lua I gleaned from example Homeworld 2 maps and my quick perusal of the documentation.
As near as I can tell the code should be good. I do recall hearing something ages ago that not all of lua was valid in Homeworld 2 and that Homeworld 2 had additional limits on what lua could do, though I haven't been able to find it again.
All my research in trying to solve this issue from searching the Homeworld end of things keeps bringing up the remastered stuff rather than the original homeworld 2 stuff, and remastered has changed things about some. Even then, I still haven't found any topics on the limits of lua scripting.
The script I made basically makes a random map of a randomly chosen style (i.e. the resources might be evenly distributed throughout the map, be concentrated in a big field, or come in clusters, or even a big ring.).
My first version of the map worked, but was messy and disorganized, so I rewrote the whole thing to be neater and easier to tweak (i.e. I moved many variables to the top so they can be easily found).
All the core code should in theory be the same, only with certain things moved around, and better commented.
I did put some of the code into functions and called the functions, but I can't find anything that says I did it wrong.
So what I need is something that can either check lua 4 code for errors (the ones that can be found without running it anyway), or something that rather clearly shows how lua 4 did things different from lua 5. Of course, if anyone knows anything about Homeworld 2 specific limitations, that would be wonderful.
If you have experience with C++, it shouldn't be a problem for you to compile a standalone version of Lua 4.0.1 (it's very easy, and the codebase is highly standards compliant, compared to typical C/C++ projects). This would certainly let you at least check for syntax errors (i.e. "errors which can be found without running it").
[wmv2 # 0xb42400]
warning, clipping 1 dct coefficients to -255..255
I'm modifying some code in a C API that interacts between FFmpeg and and an AS3 Air application to encode a video after creating something.
WMV was working okay earlier but now I've set things back I'm getting this very peculiar warning coming from the c library but it doesn't make any sense and googles not providing many answers.
I was wondering if anyone out there knew what this warning was about? When the file comes back to me it's totally empty with 0 frames. I must have changed something so I'm comparing the file from a few days ago with this one looking for anything that may have caused it to no longer work. But I was wondering if anyone had any better ideas than blindly looking through old and new code.
This particular warning comes from the FFmpeg core code. It is just warning that it had to perform an adjustment on some bits of the video stream in order to successfully decode it. It might help to understand that the WMV2 algorithm (being decoded, per your error message) was reverse engineered from binary code and reimplemented in FFmpeg, which is why things like this slip through the cracks.
My question is slightly abstract but with good grounds. I have successfully ran a JACK script written in C that loops the microphone audio data to the speaker, However I would like to know how to alter the stream of audio my self during playback, perhaps one thing I'd like to try is filter the high(or low) frequencies (CUT them completely off). From my understanding audio comes through as an analog signal and converted to a digital value (within a certain range).
I'm guessing I'm forced to go about this one of two ways, I think one way is to process each value and check if it below the frequency (or above the frequency) I don't want and then alter the value to 0(or the previous value from the last loop cycle to prevent blank spots in the audio during playback). The second way i'm guessing is that JACK presents the buffer with a full array of values that are assigned by frequency spectrum. How do I go about doing this? (In the future I want to do other things with the raw data but I think this is a great start to get familiar with raw audio processing)
Here is my simplified code: http://pastebin.com/Hmiumqkz
You can see that I tried printing the in value as its supposed to be a "float" I thought I might be able to filter frequencies from there but I'm not sure as I don't get anything printed in the console when i run this code it just loops back the mic to speaker but with out any printing to the console.....
NOTES: I have already successfully compiled and tested programs that used the Gstreamer, ALSA, NAudio, irrKang, and the Phonon libraries, they don't allow me to have the cross compatibility i need between OSs and the raw audio data I require for my project, all i ask is to please think twice before lazily report for me to use "other libraries" only for the sake of it being "easier" but I have already tried them and they all fail me.
You haven't really asked a question that can be answered here on SO, so I'll point you to some outside resources.
Here is a tutorial for designing EQs based on the popular RBJ filters:
http://blog.bjornroche.com/2012/08/basic-audio-eqs.html
Most of it is written in C-like psuedocode and will walk you through step-by-step.
Here is the correct answer (You'll notice a printf() function in the proccess(){} call back function) the for loop prints out the the current frames in the buffer(Frequency domain but the for() loop is printing over time so its the time-domain as well -- its both frequency and time)
http://pastebin.com/axDLw7cc
How would I change a pixel on a display, in C?
Assume NOTHING: I am using a linux machine from console to do this. I do not want to use GUI toolkits or frameworks to draw the pixel. I do not want to draw the pixel in a window. I want to draw the pixel directly to the screen.
EDIT: I have a screen. I'm on a laptop running linux from console. I'd prefer a solution not using X as I'd rather learn how X works than how to use X.
If theres more information, ask, but don't assume. I'm not trying to build a GUI, and that was the main purpose of blocking assumptions as I don't want people to assume I'm doing things the long way when in reality I'm just tinkering.
EDIT 2: You may use any X11 related libraries provided that you can explain how they work.
If we really assume nothing, can we even assume that X is running? For that matter, can we even assume that there is a video card? Perhaps Linux is running headless and we're accessing it over a serial console.
If we are allowed to assume a few things, let's assume that Linux has booted with framebuffer support. (It's been a couple years since I worked with Linux framebuffers, I may get some of the details wrong.) There will be a device created, probably /dev/fb or /dev/fb0. Open that file and start writing RGB values at an offset, and the screen will change, pretty much regardless of anything: text console, graphical console, full-fledged desktop envrionment, etc. If you want to see if framebuffer support is working, do dd if=/dev/zero of=/dev/fb on the command line, and the display should go all black.
C doesnt have any graphics capabilities - you'd need to use a third party library for this.
You cannot assume a display in C. There is literally no way to do what you ask.
Edit: Okay, you have a display, but again, there's not a whole lot you can get from there. The point is that there are a TON of competing standards for graphics displays, and while some of them (VGA interfaces, for example) are standardized, a lot of the others (display driver interfaces, for example) are NOT. Much of what X (and other display device drivers, such as Windows or the like) do, is have specific interface code for how to talk to the display drivers; they abstract out the complexity of dealing with the display drivers. The windowing systems, though, have HUGE libraries of complicated and specific code for dealing with the display drivers; the fact that these things are relatively transparent is an indication of just how much work they've put into these things over time.
Very primitive and making a lot of assumptions:
fd = open("/dev/fb0", O_RDWR);
lseek(fd, 640*y+x, SEEK_SET);
write(fd, "\377\377\377\377", 4);
In reality, you would use mmap rather than write, and use the appropriate ioctl to query the screen mode rather than assuming 640xHHH 32bpp. There are also endian issues, etc.
So in real reality, you might use some sort of library code that handles this kind of thing for you.
I suppose you could paint to the terminal program that you are using as your console. All you have to do is figure out which one that is and look it up.
Whoops I assumed a terminal. :P
I think what you are looking for is information on how to write to the frame buffer. The easiest way would be to use SDL and render to the frame buffer, or else use GTK+ with DirectFB, although that goes against your edict on not using toolkits or frameworks.