MPI on ARM - baremetal platform? - arm

Is MPI library supported by baremetal ARM system ? Does it work with ARM compilers? If yes, could anyone provide links/references, as I could not find it out .
Thanks
EDIT: I forgot to ask my main question. Is there any standard benchmark that uses MPI library and can be used on ARM CORTEX - M4 ? For instance LINPACK with MPI which benchmarks the Floating point unit.

that should be no problem.
the easiest way to try this out is to use OpenHPC
mpich, mvapich2 and Open MPI are provided.
an other option is to download the sources of your best MPI library and build the lib by yourself (fwiw, i am pretty sure this is your only option if you want to use modern Fortran with non GNU fortran compiler)

check out open MPI 2.1.1:
https://www.open-mpi.org/software/ompi/v2.1/
and here is how to build it:
https://developer.arm.com/products/software-development-tools/hpc/resources/porting-and-tuning/building-openmpi-with-arm-compiler
EDIT: i doubt that is benefical to use mpi on rtos/baremetal solution.
you can use uClinux for cortex m4 platform:
https://github.com/EmcraftSystems/linux-emcraft
Or you can try to porting mpi library to zephyr rtos: (a lot of work)
https://www.zephyrproject.org/

Related

AAC decoder for ARM Cortex A9

I trying to develop an application to decode AAC on an ARM Cortex A9 processor. I will not be using an OS. Therefore this will be a bare-metal application.
Are there any libraries already available for this?
I used mstorsjo-fdk-aac library on windows and Ubuntu. Is it possible to compile it for ARM to run on without an OS?
Can anyone point me in the correct direction? I searched a lot in the internet but could not get anywhere.
Thank you.
The fdk-aac codec library does depend on a libc, for standard C functions like malloc, free, math functions like sin, stdio for file handling etc. If you run on bare metal, you need to provide these functions somehow. (If you don't need the sublibrary for opening files, you probably don't need to provide the stdio functions, or it is ok to replace them with stubs.) Even if the files are C++, they don't seem to use the standard C++ library, so you probably don't need to provide that.
Luckily most of these functions seem to be separated out for easy replacement/redirection - have a look at libSYS/src/genericStds.cpp to see which facilities it depends on from the platform.

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.

Which compiler should be used for porting C code to ARM?

I am new to ARM. I have written C code,but I'm looking to port the code to ARM which runs on all ARM processors. I am going to develop high end applications such as those which run on smartphones/ tablets. Can you guys tell which is the best compiler for that? I have heard about RVDS, but that seems to be expensive.
My other question is: Can I use Microsoft Visual studio 2008 to program ARM Intrinsic like Neon? Are there any other alternatives for RVDS?
Your advice is greatly appreciated.
Several version of the gcc toolchain are available for ARM processors. You need to figure out the exact target for your code such as:
Which processor or set of processors ? What instruction sets and extensions are supported ? (There are many like ARMv6, ARMV7, ARMv7a). Some of them might have NEON support and some might not.
What kind of FPU support - hard FP vs soft FP ?
What kind of OS environment ? Linux ? Android ? Bare metal ?
Which C library - glibc, uclibc, bionic libc or something else ?
The last 2 are kind of built into the toolchain and cannot be modified. But choosing the exact instruction set and optimization can be controlled using ARM specific -m flags in gcc.
And distros like Ubuntu already have the ARM toolchain as part of their repos. You can give that a try too :
sudo apt-get install gcc-arm-linux-gnueabi

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.

Is multithreading supported in embedded Keil C?

I am developing an embedded application in LM3S6965 evaluation board using Keil C compiler. Is there any option for creating multithreaded embedded application?
You might want to check out FreeRTOS. It's a pretty simple and light-weight OS that will give you multithreading.
There are lots of other light-weight OSes too.
Multi-threading is not an intrinsic part of C, so is not provided by the compiler at all, but rather by libraries. In that respect, multi-threading can be implemented using any C compiler; it is more a case of choosing (or writing) a suitable library.
Many RTOS kernels exist for ARM Cortex-M, but the the Keil MDK-ARM includes the RTX real-time OS library which supports multi-threading.
The uVision IDE explicitly has an option to include the RTX library, and the debugger has a rudimentary level of kernel awareness. RTX itself is fairly primitive, but suited to small projects, and all of Keil's other middle-ware such as TCP/IP, USB, CAN and filesystem work with it directly.

Resources