Post Reply 
Short Guide on Compiling NewRPL
11-17-2016, 07:01 PM (This post was last modified: 11-19-2016 01:19 AM by Han.)
Post: #1
Short Guide on Compiling NewRPL
This is meant to serve as both my own personal documentation and a short guide on getting the tools to start dabbling in the newrpl source code. I will eventually put up instructions on how to get set up on all the main platforms (Windows, Mac OS X, and Linux). For Windows, I am still using Windows 7. And for Linux, I will likely be using either Slackware or Ubuntu.

Windows 7

  1. Download Qt Creator: Qt Creator Download Page (scroll down to the bottom and select the Open Source option)
  2. Install Qt Creator (using the default options will be just fine). In addition to the SDK/IDE, it will also install MinGW.
  3. Install git for Windows: Git for Windows Download Page or you can alternately use Tortoise Git as recommended by Claudio (see immediate post below)
  4. Optional: install GnuWin32 (tools such as diff): GnuWin32 Download Page
  5. Adjust your environment path to enable git (and any other GNU software) from any command line (when running cmd.exe)
    1. Right click on My Computer (or alternately click on System in the Control Panel).
    2. Select Advanced System Settings at the top left of the System window.
    3. Click on Environment Variables; either modify PATH in the user variables, or modify Path in the system variables to include the directory containing the executable for git (and other GNU software). Some setup programs may have already done this for you.
  6. Open a new command box (cmd.exe). You need a new one since any command box prior to the changes in the Environment Variables will not have the updated path changes. Type:

    git clone git://git.code.sf.net/p/newrpl/sources newrpl-sources

    This will create a directory named newrpl-sources in your user folder. For example, if you are logged into Windows as WinUser, then (assuming you do not change directories upon opening a command box via cmd.exe) the folder will be created as C:\Users\WinUser\newrpl-sources.


Compiling the NewRPL compiler for Windows

  1. Run Qt Creator. Open the newrpl-comp.pro file (project file) and click the "configure" button.
  2. To build this project, simply press CTRL+B. Or go to the Build menu and select Build project "newrpl-comp"
  3. This process creates a new folder named buil-newrpl-comp-... in the same location as the newrpl-sources folder. Within this folder is a folder named debug, which contains the executable newrpl-comp.exe.


Compiling the PC virtual calculator

  1. Compile the NewRPL compiler first; see above
  2. Copy the newrpl-comp.exe file to tools-bin folder within the newrpl-sources folder.
  3. In Qt Creator, open the newrpl-ui.pro (profile file) and compile (same instructions as for newrpl-comp project)
  4. Press CTRL+R or select Run from the Build menu to load the UI program (virtual HP50G with newrpl firmware)


Compile the firmware on Windows 7

... todo ...
-------------------------------------------------------------------------------------------------

Mac OS X (10.9.5)

  1. Install Xcode. Note that the version of Xcode that can be installed will depend on your version of OS X. For example, 10.9.5 can only use up to version 6.2 of Xcode. Xcode Downloads

    (You will need to have an Apple developer account set up.)
  2. After installing Xcode, install the Command Line Tools. This can be done with:

    xcode-select --install

    Just follow the on-screen directions (pretty simple).
  3. Download Qt Creator: Qt Creator Download Page (scroll down to the bottom and select the Open Source option)
  4. Install Qt Creator (using the default options will be just fine). As of November 17, 2016, the installer will install Qt 5.7. When selecting the install options, expand the option for Qt 5.7 and select only the OS X option (that is all that is needed for newrpl).
  5. Open a Terminal window. Type:

    git clone git://git.code.sf.net/p/newrpl/sources newrpl-sources

    This will create a directory named newrpl-sources in your user folder. For example, if you are logged into Mac OS X as MacUser, then (assuming you do not change directories upon opening a Terminal window) the folder will be created as

    /Users/MacUser/newrpl-sources

    Optional: If you want to consolidate all your build directories (which get created later), I recommend first creating a folder named newrpl, and then run the git command above within the newrpl folder. This will then install the source files to:

    /Users/MacUser/newrpl/newrpl-sources


Compiling the NewRPL compiler for Mac OS X

  1. Run Qt Creator. Open the newrpl-comp.pro file (project file) and click the "configure" button.
  2. To build this project, simply press <command>+B. Or go to the Build menu and select Build project "newrpl-comp"
  3. This process creates a new folder named buil-newrpl-comp-... in the same location as the newrpl-sources folder. Within this folder is the executable newrpl-comp.


Compiling the Mac virtual calculator

  1. Compile the NewRPL compiler first; see above
  2. In Qt Creator, open the newrpl-ui.pro (profile file) and compile (same instructions as for newrpl-comp project)
  3. Press <command>+R or select Run from the Build menu to load the UI program (virtual HP50G with newrpl firmware)


Compile the firmware on Mac OS X

  1. Download the libelf source files from: http://freecode.com/projects/libelf
  2. Compile and install libelf. Open a Terminal window and type:

    cd ~/Downloads
    tar xfzv libelf-<your version>.tar.gz
    cd libelf-<your version>
    chmod u+x configure
    ./configure
    make
    make install

    This sequence of commands will compile libelf, and install the relevant files in /usr/local (Should you ever want to uninstall it, you can do so with: make uninstall in libelf source directory.)
  3. Run Qt Creator. Open the elf2rom.pro file located within the newrpl-sources/tools/elf2rom subfolders. Click on the elf2rom.pro file shown in the Qt Creator window pane (left side of window). Modify the contents to look like:

    Code:
    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt

    SOURCES += \
        elf2rom.c

    INCLUDEPATH += /usr/local/include

    LIBS += -L/usr/local/lib -lelf

    install_bin.path = $$PWD/../../tools-bin
    install_bin.files = $$OUT_PWD/elf2rom
    INSTALLS += install_bin

    The changes are the addition of the INCLUDEPATH line and the modification of the LIBS line to add -L/usr/local/lib
  4. Build the elf2rom project using the Build menu or using <command>+B.
  5. Download the arm toolchain for Mac OS X here: Arm Toolchain Download Page
  6. Install the toolchain. Open a Terminal window if necessary, and type:

    cd ~/Downloads
    tar xfzv gcc-arm-none-eabi-<your version>-mac.tar.bz2
    sudo mv gcc-arm-none-eabi-<your version> /usr/local/gcc-arm

    The last line will move the folder containing the toolchain to /usr/local/gcc-arm
  7. In Qt Creator, open newrpl-fw.pro (project file). Then proceed to open the file named newrpl-fw.pro shown in the left pane of the Qt Creator window. Scroll down until you see a line with GCC_LIBDIR and modify it to:

    GCC_LIBDIR = /usr/local/gcc-arm/arm-none-eabi

    Then scroll down a bit more to where you see references to QMAKE_CC, QMAKE_CXX, and QMAKE_LINK. Modify these lines to look like the ones below:

    QMAKE_CC = /usr/local/gcc-arm/bin/arm-none-eabi-gcc
    QMAKE_CXX = /usr/local/gcc-arm/bin/arm-none-eabi-g++
    QMAKE_LINK = /usr/local/gcc-arm/bin/arm-none-eabi-gcc

    Save the file.
  8. If there are other projects open in Qt Creator, right-click newrpl-fw in the projects section and choose: Set "newrpl-fw" as Active Project. Then build the firmware using the Build menu or simply use <command>+B. The firmware file will be in the build-newrpl-fw-... folder (same location as newrpl-sources) and the file is named newrplfw.elf

    This section will eventually be removed once the sources are updated to presumably address the issues.
    If you see an error the function sig_digits within the decimal.c file, modify

    int sig_digits(BINT word)

    to

    BINT sig_digits(BINT word)

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Short Guide on Compiling NewRPL - Han - 11-17-2016 07:01 PM
RE: Compiling NewRPL Guide - Claudio L. - 11-17-2016, 07:26 PM
RE: Compiling NewRPL Guide - Han - 11-17-2016, 07:48 PM
RE: Compiling NewRPL Guide - Han - 11-18-2016, 03:12 AM
RE: Short Guide on Compiling NewRPL - Han - 11-18-2016, 01:35 PM
RE: Short Guide on Compiling NewRPL - Han - 11-18-2016, 03:34 PM
RE: Short Guide on Compiling NewRPL - Han - 11-18-2016, 05:49 PM
RE: Short Guide on Compiling NewRPL - Han - 11-19-2016, 01:12 AM



User(s) browsing this thread: 1 Guest(s)