Debugging a ppc64 custom OS using QEMU - qemu

I am trying to write a simple powerpc64 OS using openfirmware and qemu. My main difficulties come from the lack of a good debug output to use when printing useful information.
When developing for the x86 platform I would use the 0xE9 CPU IO port for printing, and I would redirect it to the stdout of my console using -debugcon stdio, but when searching in the online documentation of QEMU and in several forums I could not find an equivalent for ppc64.
Is there any mechanism like the 0xE9 QEMU-specific CPU port in the x86 platform that can be used for debugging when coding for ppc64, in the same fashion? Thanks in advance.

If you're using OpenFirmware and haven't quiesced it yet, perhaps you could get somewhere with the write OpenFirmware call.
See e.g. Linux's prom_printf() in arch/powerpc/kernel/prom_init.c.

Related

How to use Haskell tool xml-to-json in terminal?

I am going to use xml-to-json to process a large xml file. I searched several methods, but they did not work due to out of memory. Then I found a tool implemented in Haskell, but when I tried this tool according to the guide, it says command not found. Could anyone please tell me how to use this tool? Thanks in advance. here is the link of the tool: https://github.com/sinelaw/xml-to-json#readme
Update
Screenshot of error
Most probably, your executable is built but isn't in your PATH.
On many systems cabal installs things to $HOME/.local/bin. So you can try adding that to your PATH environment variable.
It looks like you're using a Mac, in which case the path to use is $HOME/Library/Haskell/bin/. This page seems to have relevant instructions on how to configure Mac OS X.

ESP8266 - How does it understand what "AT+RST" means without the firmware

I am new to ESP8266 and to the electronics world. I request you to please be patient if I am mis-understanding a point.
I am using ESP8266-01.
I successfully re-flashed the at official ai-thinker firmware version 1.1.1 to my module and I noticed that it was being written at memory location 0x00000.
Later I successfully uploaded a basic blink program using Arduino ide. Again the program was written to the memory location 0x00000(over-writing the firmware I guess).
I want to use it as a web server. The code for that uses the AT commands, something like "Serial.println("AT+RST");"
Now from what I understand the firmware would be over-written. Then how would the module understand what "AT+RST" means?
Thanks
"Arduino" is more than just the IDE you see and the boards (e.g. Uno). Arduino is also a kind of firmware/OS that runs on those boards. A sketch you write in the IDE is compiled together with the firmware into a single package that's written to memory.
There are a few more hints at https://github.com/esp8266/Arduino:
This project brings support for ESP8266 chip to the Arduino
environment. It lets you write sketches using familiar Arduino
functions and libraries, and run them directly on ESP8266, no external
microcontroller required.
ESP8266 Arduino core comes with libraries to communicate over WiFi
using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA
updates, use a file system in flash memory, work with SD cards,
servos, SPI and I2C peripherals.
When you hit that 'Upload' button in the IDE you're effectively replacing anything that's been written to the ESP8266 before.
This question is wrong on many levels.
It was based on the assumption that "Serial.println("AT+RST")" was a command to the esp while in reality the programmer meant it as a logging message to the serial monitor.
I had asked "How does it understand what “AT+RST” means without the firmware". The answer is that it doesn't and it can't unless I write some code in my sketch to handle it. The firmware is a kind of interpretter. It accepts a command in a particular format (e.g. "AT \n"), parses it, executes some corresponding low level function and returns the result.
After I have uploaded a sketch and over-written the AT firmware, the interpretter code is gone and hence the esp cannot interpret/understand the AT command.
#AdrianoRepetti:
"How "web server" and AT commands are related is unknown to me" - You are right, they are not related. My bad.
"Anyway AT commands is understood directly by ESP8266 chip" I doubt it.
Thanks for your answers.
This question is not adding any knowledge to anything. I think it should be deleted.

Using stl in an Android adb shell native program

I'm trying to port a C++ utility program that I want to be run from the Android ADB shell.
For that, I'm using the Android NDK's make-standalone-toolchain.sh script, and compiling my program with it.
Unfortunately, when I try to run it, I get this error:
reloc_library[1315]: 16304 cannot locate '_ZNKSs5c_strEv'...
CANNOT LINK EXECUTABLE
After some research, I saw that this means that the c_str function doesn't exist in libstdc++.so in the NDK. I also couldn't find the symbol in stlport.so either, and actually only found it in the ./sources/cxx-stl/gnu-libstdc++/libs/ version of the C++ libraries. These libraries are not included in the standalone toolchain I made, and I also couldn't find them on the device (the device is running Honeycomb).
The text in the NDK clearly states that there's support for the entire STL when I use stlport. Is this something that is only true in Ice Cream Sandwich? The libstlport.so or in libsupc++.so on the device and in the NDK didn't have any signature like the one that wasn't found.
So my question has two parts:
Is there something I'm missing in the build process/Android setup? Can I set up things differently so that the program will compile without needing the gnu-libstc++, or at least fail with a compilation/link error instead of failing to load on the device?
If linking with gnu-libstc++ is the only way, how can I do that? I think I can manage statically link to it but I'd rather not.
How can I add the gnu-libstdc++ version to my
If someone else is looking for a solution, I ended up adding a dependency using the -l switch on libgnustl_shared.so. You can find it inside the NDK at
sources/cxx-stl/gnu-libstdc++/libs/&ltarchitecture&gt/
I then pushed this .so together with the program to the device, and made a script that adds the current directory to LD_LIBRARY_PATH. It seems similar to what the NDK does when you use the make scripts to create a program that depends on gnustl.

What I need to read/analyze in order to understand how QEMU emulates supported network devices?

I would like to analyze how QEMU emulates the supported network devices reading the source code. Also I would like to share with me your opinions about what background is needed to understand QEMU's source code. Please suggest to me some good books or online sources for the surrounding topics that one has to learn in order to achieve that(I suppose Device Driver, Processor Specification etc are needed?). Also if you could tell me about the programming level that one should have in C (as the source code is written in C) that would be nice.
I have already looked at the QEMU's web site and what offers mostly refers on how to use QEMU and configure it.
For basic introduction to qemu and its networking functionalities:
What's a good source to learn about QEMU?
To get started with source code
original qemu paper
qemu-internals
http://www.ecs.syr.edu/faculty/yin/Teaching/TC2010/Proj4.pdf
https://wiki.aalto.fi/download/attachments/41747647/qemu.pdf

Terminology for web app running on hardware

I am trying to investigate how to develop an UI application that will run directly on hardware. This will be very much like when you access the web based application within your router.
I don't really know how what keywords and terminology to use so that i can search tutorials on the net.
Can anybody give me the correct terms? If you have tutorial suggestions, they are welcome as well.
Embedded may be the term you are looking for.
Appliance is another term along with Yagoo's embedded. Typically hardware appliances run full stacks including LAMP.
Many appliances are based off of stripped down Linux or FreeBSD kernels running Apache or a lightweight httpd.
There are actually specific Linux distributions that are tuned for this. Google "linux appliance distribution" and "small linux distribution"
Be advised, if it is commercial, Linux and the GNU stack may present an issue you must deal with, depending on how it is modified. FreeBSD does not have this license limitation.