This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is a pure Linux development environment possible for nRF52?

Hello everyone,

I'm brand-new here. I have developed quite a bit of software on desktop PC's, but this is my first experience with embedded programming. A few weeks ago, I was handed an nRF52 development board, a temporary computer for development work, and told to go figure it out. I followed Nordic's tutorial, based on Windows and Keil MicroVision. I got Blinky compiled, and flashed it to the board. I haven't bothered with Bluetooth yet.

Keil's free version of MicroVision limits executable files to just 32 KB. My employer has a few licenses for IAR Embedded Workbench, but they must be shared between all of us who want access. I am waiting my turn. I have read several links that suggest that Nordic's development kit also works with gcc. I may not have to use Keil or IAR.

And perhaps, I don't even have to use Windows? My permanent computer has arrived. I greatly prefer Linux, so that's what I installed first. When I plug the nRF52 board into my Linux machine, a USB media device called JLink appears. If I can compile ARM executable code and flash the board from Linux, that would be great. From my reading, I know about gcc-arm-embedded. But I do not know how to set it up. I am reading every question here on the Nordic Developer Zone with the key words gcc and/or Linux. There are hundreds of them. If anyone knows a shortcut to the posts which explain how to set up an embedded development toolchain in a pure Linux setting, I would appreciate the pointers.

As a second option, I have Windows 7 running as a guest virtual machine (to run one Windows-native app that I must use). I could set up mingw-w64 on my Windows VM, so that I can run gcc from the guest. I am attempting this right now, but to make this arrangement work I need to fix a hardware sharing problem. When I connect the Nordic board to the USB in a configuration which should forward the board from the host (Linux) OS to the guest (Windows) OS, the guest crashes.

Option 3: I can set up a full dual-boot system, with independent partitions for Linux and Win7. But nothing makes me more nervous than a bare-metal Windows device with full Internet access. (In point of fact, the loaner computer that I received when I first got here harbored a virus, which was trying to attach itself to my executables!) And I would actually prefer to access both working environments at the same time.

Thanks for reading this all the way through, and thanks for your help.

  • 1.) Download the arm-none-eabi compiler for linux. 2.) Download the Java JDK (needed by eclipse). 3.) Download eclipse for c/c++ development 4.) Get eclipse working with arm-non-eabi compiler. 5.) Create a makefile based project in eclipse and select existing code, use the nordic sdk base folder. 6.) Each project has an example makefile, look at these and use them as guidance. Also example linker scripts but you shouldnt have to touch these. 7.) get a project compiling with gcc. You'll have to build for the targets in the makefile.

    -You can download some segger tool plugins for eclipse and debug from eclipse.

    To flash from linux: download latest nRF5x tools (i think these are supported for linux). now use nrfjprog to flash hex files to your board. use pynrfjprog to write scripts and automate process. use mergehex to merge hex files (if you want to).

    • This is very undetailed - I know. but it might help. there are tutorials out there for each step but youll have to do some search.

    figure a quick answer was better than nothing. maybe someone else can help more. good luck! -Mike

  • I'm developing software for nrf51 on OS/X using gcc. I think its much more long time stable to use just a compiler and make (and maybe a tool like cmake) for a project and leave the decision for an optional IDE to the individual developers.

    I prefere make files over some xml-like IDE-projects settings, because changes to a makefile can be tracked by version managment tools like git/svn very well. If someone changes a compiler setting in an IDE project setting, it usually results in some undocumented changes in a large xml file.

    I've worked on a project where 4 different micro controllers where used from 3 different vendors. If we where using the vendors prefered IDE and compiler, we would have to use at least 2 different flavors of windows and 3 modified versions of eclipse ;-)

    Here is a small example of a nrf51 project, that uses GCC and should work without any changes on OS/X, windows (with mingw of cause) and linux: github.com/.../nrf51

    • CMakeLIsts.txt: that's some kind of makefile
    • gcc_nrf51_common.ld, nrf51_xxaa.ld: slightly changed linker scripts from nordic
    • system_nrf51.h, system_nrf51422.c, gcc_startup_nrf51.s : startup filed provided by nordic
    • runtime.cpp: minimum runtime support for C++

    In addition, you will need the SDK, that contains headers that decribe the layout of the registers.

    hth Torsten

  • Thanks for your reply. I'm a little confused by steps 4 and 5. Does Eclipse actually use GNU make? Or does it perform the jobs that make would do, using information in its project files?

    In case my system configuration matters: Ubuntu 15.04 x86_64, Eclipse 4.5.0, gcc-arm-none-eabi 4.8.3. I took care to download only 64-bit packages. I have also downloaded and extracted nRF5x_MDK_8_0_4_GCC, nRF52_SDK_0.9.1_3639cc9, and s132_nrf52_1.0.0-3.alpha.

    I am building and executing C that runs on my host machine successfully from within Eclipse.

    From the Eclipse main menu, if I click File > New > C Project, a dialog appears. On the right side of the window, the toolchain selector shows "Cross GCC" and "Linux GCC". If I uncheck the box at the bottom of the window, five more toolchains appear, but not the ARM Embedded toolchain. How do I add ARM Embedded to this list?

    Thanks!

  • Hi Torsten, Thanks for your reply. I am trying Michael Dietz's approach using Eclipse, but while I've gotten stuck, I will also try your command-line approach. (I've been using Geany. I'm overwhelmed by the complexity of Eclipse.)

  • I think Cross GCC is the correct toolchain (thats what I have selected). It looks like you have all the correct software installed. (Although you will probably need to install some eclipse plug ins if you havent already).

Related