aurel32 qemu images arm vs mips - arm

I am currently learning how to emulate both mips(el) and arm architecture using Qemu. The images which I used for both architecture is by aurel32 from this website, https://people.debian.org/%7Eaurel32/qemu/
I noticed that the mips images does not have initrd while the arm images have initrd. I am unsure why arm requires initrd when running Qemu but mips does not.
Anyone know why this is the case?
Thanks for the help!

There is no inherent reason -- you can build an Arm kernel with enough devices built-in to not need an initrd, and you can build a MIPS kernel that does require an initrd. You'd have to ask Aurelien why the two sets of images he built had different configs (assuming he even remembers 6 years later!), but I suspect it's just that for MIPS he was able to use the stock Debian kernel whereas for Arm he had to compile his own kernel, and so the configuration choices for the two weren't identical.

Related

Will all ARM compilers produce the same Assembly code and run on various CPUs?

I have been developing code for an older device which has an NXP i.MX28 single core CPU which is ARM-based. The device runs Embedded Linux.
I am now upgrading to a better device which has an NXP i.MX6UL quad core processor, of course ARM-based also, and also running Embedded inux.
Is it normal that the same toolchain which I was using for the for building the code for the i.MX28 will also work for the i.MX6UL, even though the i.MX6UL is more advanced with more cores etc.?
I have built my code now for a test with the same compiler and even run it on a Rasberry Pi which seems to run ok. The Rasberry Pi uses a Broadcom BCM2711 SoC with an ARM Cortex-A72 processor which again is a different CPU.
I therefore must ask, will any ARM toolchain build code and be able to run on any type of ARM device regardless?
CPUs differ by the core architecture (incl. instruction set) and set of peripherals. Difference in the peripherals is solved by drivers and HALs. Difference in core arch is solved by the toolchain.
If the toolchain "knows" new arch it will emit the corresponding assembly code, that will run on the new CPU. So, compilers will not produdce the same assembly, but the same source code will run after rebuild, that's the idea of high-level languages.
Problems emerge when old code contains an inline assembly, or uses some specific DSP instructions or libraries

Is it possible to compile and run the dlib library on embedded devices with ARM Cortex-M7 processors?

I have just started using the amazing dlib library in Visual Studio and I have been able to compile and run the face detection examples. I was wondering if it would be possible to compile and run the library on an Mbed device, such as this one, with an M7 (or other M-series) processor. In other words, what specifications should I look out for to determine whether a microcontroller can, if at all, run dlib. Note that Mbed devices run C++ code, so it would be possible to copy and paste the source code of dlib and compile it, but I want to know if this is possible before I purchase a board. Also, if the RAM and ROM of the board are not enough, I can always attach external RAM/ROM.
Alternatively, if anyone knows of a library that can perform face detection or recognition on an embedded device, I would be happy to hear it.
Thanks.
Although the F769 is a considerably powerful embedded device there is no chance that dlib will run on it. Machine learning algorithms, even if not run in real-time, typically require a vast amount of RAM memory, specially for online-learning (learning on the target). You can take a look at ARMs very own CMSIS NN library to see what's currently "state-of-the-art" for devices that size.
Take a look at Tensorflow Lite for Microcontrollers. You can put these on embedded devices. Wake words and object detection runs easily on various boards (Arduino Nano 33, SparkFun Edge). There's a compiler included for Mbed.
Microcontrollers are not suitable for video and image recognition even if you attach external ram. The chip you where suggestiong is top of the line in microcontroller world. But this means only 2Mb for ALL your software and only 512kb of ram onboard. Think of it this way the image you need with enough detail to recoginze someone would be atleast a few mb.
I would suggest that you look at to the application processors of ARM (A series) or NVIDA Jetson.

Multicore ARM Assembly

I am working on a program in ARM Assembly and C that runs with no OS. I am basing my code on these examples.
I am looking into using all four cores on my ARM board and didn't know where to start. I have seen explanations of how this works in x86, but I haven't come up with anything for ARM assembly in my search. Where should I start to develop multicore ARM assembly? Could somebody provide a basic example that shows this?
EDIT: I am using an Allwinner H3 CPU and I am already planning to use four different programs. I have seen this. However, after doing some research, I cannot find the mailbox addresses for the cores in the datasheet.

Ocaml for ARM cortex M4?

I would like to know if it would be possible to cross-compile application written in Ocaml on processor like STM32F407 (1MB Flash, 196kB RAM) ? (without OS).
I have read Cross-compiling ocaml apps for ARM ; the experiment seems to have been done on beaglebone; so more powerfull than STM32, and with Linux as OS.
There is also OcaPIC (http://www.algo-prog.info/ocaml_for_pic/web/index.php?id=ocapic) - which is meant for PIC processors.
Is there any similar port for ARM Cortex M4 ?
I'm not aware of a port, but see the related mailing list thread 1,2.
To get started you could use the same toolchain that you use for building a C or Arduino code to cross-compile the OCaml bytecode interpreter (ocamlrun), and then run 32-bit OCaml bytecode.
The tricky part would be to port the runtime to work without an OS (allocating memory, etc.). Projects like Mirage have done that for Xen based partially on Xen's miniOS.
Perhaps you could use FreeRTOS, ChibiOS, etc. to get started.
Once that works you can look at native code with ocamlopt, it supports armv4 to armv7, but I don't know if ARMv7E-M is a superset of that or not.
Or you could write a DSL embedded in OCaml that generates C code which you would finally run on your MCU, like Haskell does with Ivory3 and Atom4.

How to start ARM programming in linux?

I was using PIC micro controller for my projects. Now I would like to move to ARM based Controllers. I would like to start ARM using Linux (using C). But I have no idea how to start using Linux. Which compiler is best, what all things I need to study like a lot of confusions. Can you guys help me on that? My projects usually includes UART, IIC, LCD and such things. I am not using any RTOS. Can you guys help me?
Sorry for my bad English
Once you put a heavyweight OS like Linux on a device, the level of abstraction from the hardware it provides makes it largely irrelevant what the chip is. If you want to learn something about ARM specifically, using Linux is a way of avoiding exactly that!
Morover the jump from PIC to ARM + Linux is huge. Linux does not get out of bed for less that 4Mb or RAM and considerably more non-volatile storage - and that is a bare minimum. ARM chips cover a broad spectrum, with low-end parts not even capable of supporting Linux. To make Linux worthwhile you need an ARM part with MMU support, which excludes a large range of ARM7 and Cortex-M parts.
There are plenty of smaller operating systems for ARM that will allow you to perform efficient (and hard real-time) scheduling and IPC with a very small footprint. They range form simple scheduling kernels such as FreeRTOS to more complete operating systems with standard device support and networking such as eCOS. Even if you use a simple scheduler, there are plenty of libraries available to support networking, filesystems, USB etc.
The answer to your question about compiler is almost certainly GCC - thet is the compiler Linux is built with. You will need a cross-compiler to build the kernel itself, but if you do have an ARM platform with sufficient resource, once you have Linux running on it, your target can host a compiler natively.
If you truly want to use Linux on ARM against all my advice, then the lowest cost, least effort approach to doing so is perhaps to use a Raspberry Pi. It is an ARM11 based board that runs Linux out of the box, is increasingly widely supported, and can be overclocked to 900MHz
You can also try using the Beagle Bone development board. To start with it has few features like UART I2C and others also u can give a try developing the device driver modules for the hardware.
ARM Linux compilers and build toolchains are provided by many vendors. Below are your options which I know of:
1.ARM themselves in form of their product DS-5 ;
2.Codesourcery now acquired by Mentor graphics. See some instructions to obtain & install, codesourcery toolchain for ARM linux here
3.To first start programming using ARM (C , assembly ) I find this Windows-Cygwin version of ARM linux tool chain very helpfull. Here. These are prebuilt executables which work under Cygwin(A Posix shell layer) on Windows.
4.Another option would be to cross compile gcc/g++ toolchain on Linux for ARM target of your choice. Search and web will have information about how it is done. But this could be a slightly mroe involved and long-winding process.
enjoy ARM'ing.
First, you should question yourself if you really need to program assembly language, most modern compilers are hard to beat when it comes to generating optimized code.
Then if you decide you really need it, you can make life easier for your self by using inline assembler, and let the compiler write the glue code for you, as shown in this wikipedia article.
Then the compiler to use: For free compilers there are practically only two choices: either gcc or clang.
There is also a non free toolchain from arm which when i last tried, 5 years ago, produced about 30% faster code than gcc at the time. I have not used it since.
The latest version of this compiler can be found here
You can also write standalone assembler code in .s files, both gcc and clang can compile .s into .o in the same way you would compile a .c or .cpp file.
Compile
If you are using a STM32 based microcontroller you need to get CMSIS and GNU arm-non-eabi-gcc package installed. Then you need to write your own makefile to pass your c codes into arm gcc compiler.
Programming
For the programming step you need to install openocd and configure that for your specific programmer. You can find a full description on how to do that on my blog
http://bijan.binaee.com/index.php/2016/04/14/how-to-program-cortex-m-under-gnulinux-arch/ and in my GitHub repository.
IDE
I'm using vim with CTags but you can use gEdit with the Shortcut plugin if you need a simpler text editor.

Resources