Gromph
Gromph

Reputation: 163

(MCUXpresso / Eclipse project with C) Automatic headless build

Hi,

Attached are the different steps to compile a project from scratch without a GUI in a container.

I built a Docker with MCUXpresso and after cloning this project I want to compile automatically like I was a developer.

For compilation, I have found this article , and this, or this.

For linkage problem, I have found this article.

Everything works!

Step 1: How solve linkage problem.

You need to install the SDK package. Otherwise copy to your container.

docker cp </path/mcuxpresso/sdk/uc.zip> <container_name:/root/mcuxpresso/02/SDKPackages/>

SDK Package

Step 2 : Import a SDK example hello world project

MCUXpresso create a simple project via MCUXpresso

Step 3 : Copy this project in your docker.

docker cp <</source/path>> <<container_name:/destination/path>>

Step 4 : Update path of IDE.

export IDE=/usr/local/mcuxpressoide/ide/mcuxpressoide

Add IDE path

Step 5 : Compile.

$IDE -nosplash
        --launcher.suppressErrors
        -application org.eclipse.cdt.managedbuilder.core.headlessbuild
        -data \path\to\workspace
        -import {[uri:/]/path\to\project}
        -build {project_name[/build_config] | all}
        -cleanBuild {project_name[/build_config] | all}

Compilation OK

Step 6 : Finished.

Everything works.

Upvotes: 4

Views: 1431

Answers (1)

Gromph
Gromph

Reputation: 163

Install MCUXpresso in Docker:

Preliminary step: Need download MCUXpresso before launch docker build.

FROM ubuntu:bionic
LABEL Description="Image for buiding arm project with mcuxpresso"
WORKDIR  /usr/src/mcuxpresso

ENV DEBIAN_FRONTEND noninteractive
ENV IDE_VERSION 11.0.0_2516

COPY mcuxpresso/mcuxpressoide-${IDE_VERSION}.x86_64.deb.bin /usr/src/mcuxpresso

# Install any needed packages specified in requirements.txt
RUN apt update && \
    apt upgrade -y && \
    apt install -y \
    # Development files
    whiptail \
    build-essential \
    bzip2 \
    libswt-gtk-3-jni \
    libswt-gtk-3-java \
    wget && \
    apt clean

# Install mcuxpresso
RUN chmod a+x mcuxpressoide-${IDE_VERSION}.x86_64.deb.bin &&\
  # Extract the installer to a deb package
  ./mcuxpressoide-${IDE_VERSION}.x86_64.deb.bin --noexec --target mcu &&\
  cd mcu &&\
  dpkg --add-architecture i386 && apt-get update &&\
  apt-get install -y libusb-1.0-0-dev dfu-util libwebkitgtk-1.0-0 libncurses5:i386 udev &&\
  dpkg -i --force-depends JLink_Linux_x86_64.deb &&\
  # manually install mcuxpressoide - post install script fails
  dpkg --unpack mcuxpressoide-${IDE_VERSION}.x86_64.deb &&\
  rm /var/lib/dpkg/info/mcuxpressoide.postinst -f &&\
  dpkg --configure mcuxpressoide &&\
  apt-get install -yf &&\
  # manually run the postinstall script
  mkdir -p /usr/share/NXPLPCXpresso &&\
  chmod a+w /usr/share/NXPLPCXpresso &&\
  ln -s /usr/local/mcuxpressoide-${IDE_VERSION} /usr/local/mcuxpressoide

ENV TOOLCHAIN_PATH /usr/local/mcuxpressoide/ide/tools/bin
ENV PATH $TOOLCHAIN_PATH:$PATH    

RUN rm mcuxpressoide-${IDE_VERSION}.x86_64.deb.bin
RUN rm -rf mcu

Upvotes: 2

Related Questions