Zephyr OS LLVM IR - llvm

I want to get the LLVM IR of the zephyr os (https://github.com/zephyrproject-rtos/zephyr) for static analysis. For this I need to get the IR for each file basically. But as pointed out each file cannot be compiled directly as zephyr requires a board architecture and and app for a Kconfig and then using python scripts produces some header files which are not present from beforehand. So can you pls suggest what I can do ? Is there some way that I can get all the files required for the compilation of each file seperately even if they dont compile all together.
I have been trying to do this but I am unable to do so. Can you pls suggest. Thanks.

Related

Generating working CHM files using Doxygen and GraphViz (Invalid .hhc file?)

I'm in the middle of documenting my C++ GUI library and I just started using Doxygen. I've got two test files that are documented now, but I have problems when trying to generate the CHM help files. Doxygen runs without error, and dot appears to be functioning correctly to generate images.
However, it appears the resulting .hhc, .hhk, and .hhp files are broken in some way. index.hhc and index.hhk are exactly the same and running 'hhc index.hhp' does not work. It returns an error :
HHC6000: Error: An internal file could not be created. Make certain there is enough disk space on the drive where you are compiling your file.
HHC5007: Error: Fatal navigational compilation error. This is likely the result of an invalid contents (.hhc) file.
I have uploaded a zip file of my two test sources, the Doxyfile generated by the Doxy Wizard, and the .hh* files created by doxygen.
http://members.allegro.cc/EdgarReynaldo/temp/test1.zip
Both HTML Help Workshop and GraphViz are on my path.
Do I need to change a setting in the doxyfile? How do I fix this?
Regards, bugsquasher
EDIT
After taking albert 's advice, everything seemed to magically work. Nothing was really different though.

How is dynasm supposed to be setup?

I'm trying to use dynasm. I've found several tutorials online for it, but they all require using weird lines of code such as |.arch x64 that my compiler (MSVC) rejects. There are mentions of an offline Lua parser and .dasc files but none of these tutorials mention how any of this should be setup.
How is dynasm supposed to be setup in a project?
DynASM allows you to write down assembly much easier by mixing C code and ASM code. DynASM files must be preprocessed. The output of compiling a DynASM file (.dasc) is a C file (.c) which you can later integrate in your project.
To preprocess a DynASM file you should use the dynasm program which comes with LuaJIT source code (dynasm/dynasm.lua). The "weird" lines you mentioned are the ASM code that it's processed by DynASM. The asm code is stored as byte values into an array called actions in the resulting C program.
There's a great turorial on DynASM by Josh Haberman: Hello, JIT World: The Joy of Simple JITs. The tutorial includes example code. The code is available as a GitHub repository. Fetch it and start playing with it (note: currently master branch doesn't build, I just sent a pull-request to fix it).
Another good intros to DynASM are:
The Unofficial DynASM documentation (includes tutorials, instruction reference, etc).
DynASM Luapower (DynASM from .lua files).

Trace32 compile .t32 file

I find trace32 can use some .t32 plugin to help debug OS dump.But I can not find the source file to build it.For example: t32\demo\arm\kernel\rtxarm\rtx.t32. Can anyone find me a example project?
rtx.t32 is a binary extension to TRACE32. You can't get the sources anywhere.
However Lautebach has an development kit (EDK), which allows you to write your own extension for OS awareness. To get this EDK you have to contact Lautebach and probably sign an NDA.

How to compile and execute a stand-alone SML-NJ executable

I have seen one other answer link but what I don't understand is what is basis.cm and what's it's use?
You are asking two questions.
What is basis.cm and what's it's use?
This is the Basis library. It allows the use of built-in functions.
How to compile and execute a stand-alone SML-NJ executable
Assuming you followed Jesper Reenberg's tutorial on how to execute a heap image, the next thing you need in order to have SML/NJ produce a stand-alone executable is to convert this heap image. One should hypothetically be able to do this using heap2exec, a tool that takes the heap image, e.g. the .x86-linux file generated on my system, and generates an .asm file that can be assembled and linked.
Unfortunately, this tool is not very well-maintained, so you have to
Go to the smlnj.org page and fix the download-link by removing 'www.' (this page and the SourceForge page don't contain the same explanations or assumptions about argument count, and neither page's download link work).
Download and extract this tool, and fix the 'build' script so it points to your ml-build tool
Fix the tool's argument use by changing [inf, outf] to [_, inf, outf]
Run ./build which generates 'heap2asm.x86-linux' on my system
For example, in order to generate an .asm file for the heap2asm program itself, run
sml #SMLload heap2asm.x86-linux heap2asm.x86-linux heap2asm.s
At this point, I have unfortunately been unable to produce an executable that works. E.g. if you run gcc -c heap2asm.s and ld heap2asm.o, you get a warning of a missing _start label. The resulting executable segfaults even if you rename the existing _sml_heap_image label to _start. That is, it seems that a piece of entry code that the runtime environment normally delivers is missing here.
At this point, discard SML/NJ and use MLton for producing stand-alone binaries.

Create utility like Linux "df", based on source code of this utility

In university a have task - find source code of utility df, and using it code - create my own simple utility like df.
But then I simply tried to compile source code of it (file df.c) from (for ex) this site - gcc compilation has errors with library and a lot of other errors..
On first step - when I do:
gcc -o df.out df.c
I have this error:
df.c:21:20: fatal error: config.h: no such file.
But in /usr/lib folders in my pc there is this file. What's wrong? Or what is another way to create my own df utility?
problem to me is to understand what are doing in code of df.c, because
there are using SUCH lots of constants, functions and 'define'
variables from many headers.
The very site you mention above has hyperlinks to the definitions everywhere in the code, so you can quickly navigate wherever you need to.