i want to create new library for my e-paper using atmega32 and eclipse enviroment. What do i have to know about it moreover how it works. I dont want to use arduino libraries, want to write it on my own. How to best start making it? I know how to use SPI, what commands do i have to send to display, but do i have to have any drivers which are necessarily? Is any possibilty to program it using only this module:
https://www.waveshare.com/1.54inch-e-paper-module-b.htm
and SPI? Or it is necessary to have some drivers to do it?
Your question a little bit strange, because "driver" is usually piece of code, written by a third person. So, answer is yes - it is always possible to do it from scratch, without using third-side software.
First what you need to know is what type of controller being used in that display, to get technical documentation (datasheet). Unfortunately, there is no such information, but there is a link to the specification document: https://www.waveshare.com/w/upload/9/9e/1.54inch-e-paper-b-specification.pdf
Read it carefully. For example at page 8 you can find the list of commands, which are used to control the display, and below the detailed description of the commands.
At pages 24, 25 you can find initialization sequence, and reference flowchart.
If any doubts, you can download and investigate how third-party libraries are done. For example here: https://github.com/waveshare/e-Paper
Related
When creating an mbed application, is it possible to see the code that is used for the specific device?
E.g., for the NUCLEO_WB55RG I would like to see the ST drivers that are used.
I took a look in the mbed docs but did not see anything regarding that.
If you have the source, of course you can "see" it. Check your link map to see what is included in the build or use a debugger to step "in-to" the third-party code - if the source is available it should be shown as you enter it.
Moreover any of the code included that is open-source, you will be able to access the source, even if it is delivered to you as object code. For example in your case, from https://os.mbed.com/platforms/ST-Nucleo-WB55RG/ follow the link https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/README.md
I have been trying to create a new "Custom machine" for QEMU and trying to understand the code structure of QEMU. There is a lot of help for QEMU's internal code structure like TCG etc.
But I want to understand the functions or inherited functions and syntax used to write a custom machine. For example SYS_BUS_DEVICE, what is the definition of this? What are the usages, how to use etc.
I am not sure if my question is even right or SYS_BUS_DEVICE is a user definition. Can someone clarify this? Or point me to any documentation which describes the custom machine development.
Every time I try to look for such code structure I end up with QEMU internal code. Are they both same? Is definitions like SYS_BUS_DEVICE is internal to QEMU?
SYS_BUS_DEVICE is a QOM object used to define devices on a bus. It's part of the object model. What documentation we have for developers can be found at: https://qemu.readthedocs.io/en/latest/devel/index.html (specifically https://qemu.readthedocs.io/en/latest/devel/qom.html).
I want to build an interface in a c program which is running on an embedded system. This should accept some bytecode that represents a c function. This code will then be loaded into the memory and executed. This will then be something like remotely inject code into a running app. The only difference here is that i can implement, or change the running code and provide an interface.
The whole thing should be used to inject test code on a target system.
My current problem is that I do not know how to build such a byte code out of an existing c function. Mapping and executing this is no problem if I would knew the start address of the function.
Currently I am working with Ubuntu for testing purposes, this allows me to try some techniques which are not possible in the embedded system (according to missing operating system libs).
I build an shared object and used dlopen() and dlsym() to run this function. This works fine, the problem is just that i do not have such functions in the embedded system. I read something about loading a shared object into memory and run it, but i could not find examples for that. (see http://www.nologin.org/Downloads/Papers/remote-library-injection.pdf)
I also took a simple byte code that just print hello world in stdout. I stored this code in memory using mmap() and execute it. This also worked fine. Here the problem is that I don't know how to create such a byte code, I just used an hello world example form the internet. (see https://www.daniweb.com/programming/software-development/threads/353077/store-binary-code-in-memory-then-execute-it)
I also found something here: https://stackoverflow.com/a/12139145/2479996 which worked very well. But here i need a additional linker script, already for such a simple program.
Further I looked at this post: https://stackoverflow.com/a/9016439/2479996
According to that answer my problem would be solved with the "X11 project".
But I did not really find much about that, maybe some of you can provide me a link.
Is there another solution to do that? Did I miss something? Or can someone provide me another solution to this?
I hope I did not miss something.
Thanks in advance
I see no easy solution. The closest that I am aware of is GCC's JIT backend (libgccjit). Here is a blog post about it.
As an alternative, you could using a scripting language for that code that needs to be injected. For instance, ChaiScript or Lua. In this question, there is a summary of options. As you are on an embedded device, the overhead might be significant, though.
If using an LLVM based backend instead of GCC is possible, you can have a look at Cling. It is a C++ interpreter based on LLVM and Clang. In my personal experience, it was not always stable, but it is used in production in CERN. I would except that the dynamic compilation features are more advanced in LLVM than in GCC.
This is my first embedded project, so bear with my ignorance. I've been asked to implement Remote NDIS over USB, using the ColdFire USB-Lite stack by CMX. I've been searching for a long time now, and can't find any clear documentation for this stack.
It comes with some woefully documented sample code and the only useful resource I've been able to find online is this Application Note (PDF) by Eric Gregori.
What I really want is an explanation of all the functions in the API. I can work out how to use them. Does this exist? Can someone point me to it?
EDIT: Nevermind.
After tracing the execution across 14 half-documented source files (from the example program) and scrutinizing a bunch of undocumented variables and buffers, and doing a diff between corresponding files in different projects, I think I finally get it. So I guess stackoverflow.com taught me patience... or something.
The link you referred to doesn't work for me, but the name of the file made me look at the Freescale pages, and if that's not the document you intended to link to, it might be the documentation you need.
I'm looking for a tool that, given a bit of C, will tell you what symbols (types, precompiler definitions, functions, etc) are used from a given header file. I'm doing a port of a large driver from Solaris to Windows and figuring out where things are coming from is getting to be difficult, so this would be a huge help. Any ideas?
Edit: Not an absolute requirement, but tools that work on Windows would be a plus.
Edit #2: To clarify what I'm trying to do, I have a codebase I'm trying to port, which brings in a large number of headers. What I'd like is a tool that, given foo.c, will tell me which symbols it uses from bar.h.
I like KScope, which copes with very large projects.
KScope http://img110.imageshack.us/img110/4605/99101zd3.png
I use on both Linux and Windows :
gvim + ctags + cscope.
Same environment will work on solaris as well, but this is of course force you to use vim as editor, i pretty sure that emacs can work with both ctags and cscope as well.
You might want give a try to vim, it's a bit hard at first, but soon you can't work another way. The most efficient editor (IMHO).
Comment replay:
Look into the cscope man:
...
Find functions called by this function:
Find functions calling this function:
...
I think it's exactly what are you looking for ... Please clarify if not.
Comment replay 2:
ok, now i understand you. The tools i suggested can help you understand code flow, and find there certain symbol is defined, but not what are you looking for.
Not what you asking for but since we are talking i have some experience with porting and drivers (feel free to ignore)
It seems like compiler is good enough for your task. You just starting with original file and let compiler find what missing part, it will be a lot of empty stubs and you will get you code compiled.
At least for beginning i suggest you to create a lot of stubs and modifying original code as less as possible, later on once you get it working you can optimize.
It's might be more complex depending on the type of driver your are porting (I'm assuming kernel driver), the Windows and Solaris subsystems are not so alike. We do have a driver working on both solaris and windows, but it was designed to be multi platform from the beginning.
emacs and etags.
And I leverage make to run the tag indexing for me---that way I can index a large project with one command. I've been thinking about building a master index and separate module indecies, but haven't gotten around to implementing this yet...
#Ilya: Would pistols at dawn be acceptable?
Try doxygen, it can produce graphs and/or HTML and highly customizable