Giter Site home page Giter Site logo

grisp-software's Introduction

GRISP

Prerequisites

  • the xz decompression tool needs to be installed

  • the zlib development files are necessary

  • bison, flex and texinfo

  • to check for some of RTEMS source builders prerequisites

    git submodule init
    git submodule update rtems-source-builder
    cd rtems-source-builder
    ./source-builder/sb-check

Quick Start Guide

You can build the whole toolchain by running ./build/build.sh. See [Building] for more details.

To build the simple RTEMS sample application, go to grisp-simple-sample and call make.

If you want to use OpenOCD, you have to make sure that you have read and write access to the USB device. On a Linux system using udev, you can copy the udev-rule from build/99-grisp.rule to /etc/udev/rules.d/ for that. The rule also provides a fixed name for the serial console (/dev/ttyGRiSP).

Directory Structure

The following directory structure is used in this project:

  • build: scripts for building the tool chain and libraries

  • grisp-XYZ: applications

  • libXYZ: non-RTEMS libraries

  • rtems-XYZ: software and libraries related to RTEMS

  • README.asciidoc: this document

Building

The complete toolchain is built by running ./build/build.sh. This will do the following:

  • check out the necessary git submodules

  • bootstrap RTEMS

  • build and install the toolchain

  • build and install the RTEMS BSP

  • build and install necessary libs

All installations are made inside the rtems-install subdirectory in the base directory of the repository. To change the install location edit the PREFIX in build/configuration.sh.

git Repository Structure

The grisp-software project pulls in a number of git submodules (like RTEMS). Most of these submodules have been forked with no or only minimal changes. The branches in the submodules follow the following guidelines:

  • master tracks the upstream development of the project.

  • If patches are necessary, they will be added on branches and the commits on the branch are referenced in grisp-software.

Here is an example for how a git tree of a submodule could look like:

 o---o---o---B'--o---o---o---o---o---o  master (clone of upstream/master)
      \               \
       \               A'--C'  grisp-20171110-xyz
        \
         A---B---C  grisp-20171020-xyz

In that example grisp-20171020-xyz is a version of the software with some adaptions for GRiSP. If for example a (maybe slightly modified) version of the patch B has been accepted in the upstream repository and GRiSP now wants to update to a newer version of the master, B is no longer necessary. Therefore the new grisp-20171110-xyx no longer contains B but (adapted) versions of A and C are still necessary.

The old grisp-20171020-xyz is still be kept so that a old version of the grisp-software repository can still access the commits.

That structure makes it relatively easy to see the exact differences to the upstream version and which patches might should be integrated into it in the future. The disadvantage is that it will leave quite a number of old branches that are still necessary so that older grisp-software revisions can reference them.

Re-Building only target specific RTEMS libs

Since building the toolchain takes a lot of time and since the toolchain changes less often than the rest of the system you can also just rebuild RTEMS and its libs.

To do that delete the rtems-install/rtems-4.12/arm-rtems4.12/atsamv directory and then do a

./build/build.sh --no-toolchain --no-bootstrap

Updating the submodules from github

When you want to rebuild with some new version from the Git repos you need to make sure that you update the sumodules:

git pull
git submodule update

Cleaning

Normally, running ./build/build.sh (or any other of the individual build scripts in the ./build folder) should rebuild without the need for cleaning.

However, if you want a clean start you can delete the rtems-install folder which will delete all created binaries, libraries and header files.

To make a complete reset of the whole repository, use the following commands:

git co .        # Reverts all uncommited changes
git clean -dxn  # gives a preview, what unversioned files would be deleted
git clean -dxf  # deletes everything that is not under version control

Boot Loader

The boot loader will try to initialize and mount the SD card. In case this is successful it tries to read the grisp.ini configuration file from the SD root directory.

Sample grisp.ini (showing the default values):

[boot]
timeout_in_seconds = 3
image_path = /media/mmcsd-0-0/grisp.bin

All values are optional and in case something is missing default values will be used (presented in the listing above). Once the timeout expired without user input the automatic application load sequence starts.

Updating the Boot Loader

For updating the bootloader build OpenOCD by running ./build/build-openocd.sh. You can then update the boot loader with the following call:

./build/debug-load-flash.sh grisp-bootloader/binaries/bootloader.exe

The process will need quite some time (about 30 seconds for loading and about a minute for verify).

If OpenOCD is failing due to libusb related issues, you might need to make adjustments specific to your operating system. Please see the libusb FAQ: https://github.com/libusb/libusb/wiki/FAQ

Debugging

It is possible to debug an application using the on-board FTDI to SWD adapter. First build and install OpenOCD by running ./build/build-openocd.sh.

Place a SD with some sample application into the target. This takes care that the bootloader starts an application. The debug scripts will wait for this and then overwrite the application that is booted by the bootloader with the one that should be debugged.

After that you should start openocd on one console using ./build/debug-start-openocd.sh. This starts an GDB-Server. Do not terminate the process. You can then start a gdb that connects to the server using ./build/debug-start-gdb.sh path/to/app.exe. The script adds a reset command to the normal gdb that restarts the target and reloads the application. Note that for bigger applications, that might need quite some time.

WiFi

By default, the wpa_supplicant.conf from the root of the SD card will be used. For a default WPA2 encrypted network, the file should look like follows:

network={
    ssid="mynetwork"
    key_mgmt=WPA-PSK
    psk="secret"
}

grisp-software's People

Contributors

a-leibold avatar c-mauderer avatar eproxus avatar holzingk avatar peerst avatar sebhub avatar sylane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grisp-software's Issues

Debugging with OpenOCD/GDB is not working.

When trying to debug with OpenOCD and GDB, the debugger is not working properly after breaking.

First Issue

When setting a breakpoint (hardware or software) and continuing the execution GDB break correctly but then stepi do not advance the code pointer. This happens even when masking the interruptions.

Second Issue

When setting a breakpoint at a give line number in some code compiled with debug info and without optimization (-g -O0) GDB set the breakpoint to the beginning of the function regardless of the specified line number.

Example

Host

Ubuntu 17.04 64-bit
Intel® Core™ i7-4770K CPU @ 3.50GHz × 8

GDB Console

GNU gdb (GDB) 7.12
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-rtems4.12".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from testproject/erts-9.2/bin/beam...done.
0x00400144 in ?? ()
force hard breakpoints
$1 = "Resetting target"
Reset, run bootloader and stop system
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00400144 msp: 0x20401148
target halted due to watchpoint, current mode: Thread 
xPSR: 0x21000000 pc: 0x0049ab3c psp: 0x732240c8
breakpoint set at 0x70000144
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x70000144 psp: 0x73224140
Loading section .start, size 0x3f8 lma 0x70000000
Loading section .text, size 0x31f394 lma 0x70000400
Loading section .init, size 0xc lma 0x7031f794
Loading section .fini, size 0xc lma 0x7031f7a0
Loading section .rodata, size 0x2106b8 lma 0x7031f7c0
Loading section .ARM.exidx, size 0x8 lma 0x7052fe78
Loading section .eh_frame, size 0x4 lma 0x7052fe80
Loading section .init_array, size 0x4 lma 0x7052fe84
Loading section .fini_array, size 0x4 lma 0x7052fe88
Loading section .rtemsroset, size 0x878 lma 0x7052fe8c
Loading section .data, size 0x1ed8c lma 0x70530708
Loading section .rtemsrwset, size 0x3fd4 lma 0x7054f498
Start address 0x70000144, load size 5583944
Transfer rate: 126 KB/sec, 15685 bytes/write.
(gdb) set remote hardware-breakpoint-limit 8
(gdb) set remote hardware-watchpoint-limit 4
(gdb) hbreak ethr_thr_create:405
Hardware assisted breakpoint 1 at 0x702e80ea: file pthread/ethread.c, line 320.
(gdb) continue
Continuing.

Breakpoint 1, ethr_thr_create (tid=0x7055ff30 <sig_dispatcher_tid>, func=0x7013fe39 <signal_dispatcher_thread_func>, arg=0x0, opts=0x7061b034) at pthread/ethread.c:320
320				  : -1 /* Use system default */);
(gdb) monitor cortex_m maskisr on
cortex_m interrupt mask on
(gdb) print $pc
$2 = (void (*)()) 0x702e80ea <ethr_thr_create+14>
(gdb) stepi

Breakpoint 1, ethr_thr_create (tid=0x7055ff30 <sig_dispatcher_tid>, func=0x7013fe39 <signal_dispatcher_thread_func>, arg=0x0, opts=0x7061b034) at pthread/ethread.c:320
320				  : -1 /* Use system default */);
(gdb) print $pc
$3 = (void (*)()) 0x702e80ea <ethr_thr_create+14>
(gdb) stepi

Breakpoint 1, ethr_thr_create (tid=0x7055ff30 <sig_dispatcher_tid>, func=0x7013fe39 <signal_dispatcher_thread_func>, arg=0x0, opts=0x7061b034) at pthread/ethread.c:320
320				  : -1 /* Use system default */);
(gdb) print $pc
$4 = (void (*)()) 0x702e80ea <ethr_thr_create+14>
(gdb) continue
Continuing.

Breakpoint 1, ethr_thr_create (tid=0x7055ff30 <sig_dispatcher_tid>, func=0x7013fe39 <signal_dispatcher_thread_func>, arg=0x0, opts=0x7061b034) at pthread/ethread.c:320
320				  : -1 /* Use system default */);
(gdb) print $pc
$5 = (void (*)()) 0x702e80ea <ethr_thr_create+14>
(gdb) next

Breakpoint 1, ethr_thr_create (tid=0x7055ff30 <sig_dispatcher_tid>, func=0x7013fe39 <signal_dispatcher_thread_func>, arg=0x0, opts=0x7061b034) at pthread/ethread.c:320
320				  : -1 /* Use system default */);
(gdb) print $pc
$6 = (void (*)()) 0x702e80ea <ethr_thr_create+14>
(gdb) 

OpenOCD Console

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
adapter speed: 1800 kHz
cortex_m reset_config sysresetreq
Info : flash bank command
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
adapter speed: 6000 kHz
basic initialization done
reset_and_run_bootloader
Info : clock speed 6000 kHz
Info : SWD DPIDR 0x0bd11477
Warn : Silicon bug: single stepping will enter pending exception handler!
Info : atsame70q21.cpu: hardware has 8 breakpoints, 4 watchpoints
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00400144 msp: 0x20401148
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0xa1020e00
force hard breakpoints
Reset, run bootloader and stop system
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00400144 msp: 0x20401148
target halted due to watchpoint, current mode: Thread 
xPSR: 0x21000000 pc: 0x0049ab3c psp: 0x732240c8
breakpoint set at 0x70000144
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x70000144 psp: 0x73224140
cortex_m interrupt mask on

Device will sometimes not boot

When deploying https://github.com/Theuns-Botha/grisp_wifi_connect to my grisp_base device, using sudo mix grisp.deploy, the boot procedure starts hanging without any additional information after the following message in the:

notice: wlan0: link state changed to UP
wlan0: Associated with b0:89:00:25:20:e0
err: wlan0: ipv4_sendrawpacket: No buffer space available
afatal extension: source=0, is_internal=0, error=30

Note that I see this message in the terminal that I open over the serial connection.

This does not happen all the time, I sometimes get successful boots after a few retries.

Note that I deliberately excluded my wpa_supplicant.conf file from the commit.

Build fails on Mac OS 10.10.5

Following instructions, this happens, after calling ./build/build.sh:

Waf: Leaving directory `/[...]/grisp-software/rtems-libbsd/build/arm-rtems4.12-atsamv'
'install-arm-rtems4.12-atsamv' finished successfully (3.752s)
+ '[' atsamv == atsamv ']'
+ mv /[...]/grisp-software/build/..//rtems-install/rtems-4.12//arm-rtems4.12/atsamv/lib/linkcmds.org /[...]/grisp-software/build/..//rtems-install/rtems-4.12//arm-rtems4.12/atsamv/lib/linkcmds
+ /[...]/grisp-software/build/build-libinih.sh
+ set -e -u
+++ dirname -- /[...]/grisp-software/build/build-libinih.sh
++ CDPATH=
++ cd -- /[...]/grisp-software/build
++ pwd
+ SCRIPTDIR=/[...]/grisp-software/build
+ PROJECTDIR=/[...]/grisp-software/build/../
+ source /[...]/grisp-software/build/configuration.sh
++ BSP_NAME=atsamv
++ RTEMS_CPU=arm
++ RTEMS_VERSION=4.12
++ TARGET=arm-rtems4.12
++ PREFIX=/[...]/grisp-software/build/..//rtems-install/rtems-4.12/
++ RTEMS_SOURCE_DIR=/[...]/grisp-software/build/..//rtems
++ LIBBSD_SOURCE_DIR=/[...]/grisp-software/build/..//rtems-libbsd
++ LIBINIH_SOURCE_DIR=/[...]/grisp-software/build/..//libinih
++ LIBGRISP_SOURCE_DIR=/[...]/grisp-software/build/..//libgrisp
++ BSP_CONFIG_OPT=("--disable-tests" "--disable-networking" "--enable-chip=same70q21" "--enable-sdram=is42s16320f-7bl" "ATSAM_CONSOLE_DEVICE_TYPE=1" "ATSAM_CONSOLE_DEVICE_INDEX=2" "ATSAM_MEMORY_QSPIFLASH_SIZE=0x0" "ATSAM_MEMORY_NOCACHE_SIZE=0x8000")
+ export 'PATH=/[...]/grisp-software/build/..//rtems-install/rtems-4.12//bin:[...]/grisp-software/build/..//rtems-install/rtems-4.12//bin:/usr/local/opt/asdf/bin:/usr/local/opt/asdf/shims
+ PATH='/[...]/grisp-software/build/..//rtems-install/rtems-4.12//bin:/[...]/grisp-software/build/..//rtems-install/rtems-4.12//bin:/usr/local/opt/asdf/bin:/usr/local/opt/asdf/shims
+ cd /[...]/grisp-software/build/..//libinih
+ make clean install
rm -rf b-atsamv
mkdir b-atsamv
mkdir b-atsamv/inih
arm-rtems4.12-ar rcu b-atsamv/libinih.a
arm-rtems4.12-ar: `u' modifier ignored since `D' is the default (see `U')
arm-rtems4.12-ranlib b-atsamv/libinih.a
mkdir -p /[...]/grisp-software/libinih/../rtems-install/rtems-4.12/arm-rtems4.12/atsamv/lib/include/inih
install -m 644 b-atsamv/libinih.a /[...]/grisp-software/libinih/../rtems-install/rtems-4.12/arm-rtems4.12/atsamv/lib
install -m 644 inih/*.h /[...]/grisp-software/libinih/../rtems-install/rtems-4.12/arm-rtems4.12/atsamv/lib/include/inih
install: inih/*.h: No such file or directory
make: *** [install] Error 71

Bootloader shell is confused about directories

Using a micro SD with typo in grisp.ini triggered entering the shell with the card mounted:

media listener: event = MOUNT, state = SUCCESS, src = /dev/mmcsd-0-0, dest = /media/mmcsd-0-0
boot: open file "/media/mmcsd-0-0/grisp.bin"... failed
shell:cannot set terminal attributes(/dev/console)

RTEMS Shell on /dev/console. Use 'help' to list commands.
[/] # 

Then on the shell of the bootloader:

[/] # ls
console   mmcsd-0-0 ttyUART0  ttyUART2  ttyUART4  ttyUSART1 zero
mmcsd-0   null      ttyUART1  ttyUART3  ttyUSART0 ttyUSART2

./etc:
group     issue     issue.net passwd

./media:
mmcsd-0-0
[/] # cd media
[/media] # ls
.Spotlight-V100 ._.Trashes      grisp.ini
.Trashes        beam.bin        otp
[/media] # cat grisp.ini
cat: grisp.ini: No such file or directory

It seems ls allways shows whats one lever further down that we actually are.

Bootloader doesn't display a version

The bootloader should have a version number (semver) and display it
on the bootscreen.

Otherwise we can never tell which version of the Bootloader we have on a board

Distributed Erlang on GRiSP

The GRiSP memory card is formatted FAT and has no permissions. If one creates a cookie file and copies that to a home directory on the memory card, then booting breaks with error message that a cookie file should be readable by the owner only.

The solution might be to have a home directory in the RAM disk. This requires a change in the GRiSP board.

A quick work around if to use a command line option in the .ini file

Building rtems-libbsd doesn't work from a fresh checkout

The reason is that there is the sequence

waf clean
waf configure

in the build script, but waf clean doesn't work if it was never configured.

Workaround: on the first run after a fresh checkout comment out waf clean in
build/build-libbsd.sh

Building fails under Ubuntu 16.04

`./build/build.sh' fails with some weird linker error quite late in the process.

[2159/2208] Linking build/arm-rtems4.12-atsamv/arphole.exe
[2160/2208] Linking build/arm-rtems4.12-atsamv/cdev01.exe
[2161/2208] Linking build/arm-rtems4.12-atsamv/commands01.exe
[2162/2208] Linking build/arm-rtems4.12-atsamv/condvar01.exe
[2163/2208] Linking build/arm-rtems4.12-atsamv/debugger01.exe
[2164/2208] Linking build/arm-rtems4.12-atsamv/dhcpcd01.exe
linkcmds.base:392 cannot move location counter backwards (from 0000000020480f38 to 0000000020458000)
collect2: error: ld returned 1 exit status
linkcmds.base:392 cannot move location counter backwards (from 00000000205224a0 to 0000000020458000)
collect2: error: ld returned 1 exit status
linkcmds.base:392 cannot move location counter backwards (from 00000000205237e0 to 0000000020458000)
collect2: error: ld returned 1 exit status
Waf: Leaving directory `/home/kilian/grisp-software/rtems-libbsd/build/arm-rtems4.12-atsamv'
Build failed
 -> task in 'commands01.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'debugger01.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'dhcpcd01.exe' failed with exit status 1 (run with -v to display more information)

I use a Ubuntu 16.04 VM with

sudo apt-get install git zlib1g-dev bison flex texinfo curl automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev python2.7-dev

and

$ mkdir ~/bin 
$ curl -o ~/bin/waf https://waf.io/waf-2.0.2
$ chmod +x ~/bin/waf

Issue with the provided udev rules.

The udev rules build/99-grisp.rules do not seem to work as expected on Linux.
I had to remove ATTRS{bInterfaceNumber}=="01" for the symlink to be created.

It seems that ENV{ID_USB_INTERFACE_NUM}=="01" would be doing what is wanted but I don't really understand why we would want to do that in the first place.

What are the reasons behind this part of the rule ?

Source Builder expects xz at fixed location

For some reason the rtems-source-builder generates a script with a fixed path to xz. This is a problem on MacOS where xz is located somewhere else.

Excerpt from log:

+ build_top=/Users/peer/projects/grisp/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gdb-7.11-x86_64-apple-darwin14.5.0-1
+ gdb_source=gdb-7.11
+ source_dir_gdb=gdb-7.11
+ cd /Users/peer/projects/grisp/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gdb-7.11-x86_64-apple-darwin14.5.0-1
+ /bin/rm -rf gdb-7.11
+ /usr/local/bin/xz -dc /Users/peer/projects/grisp/grisp-software/rtems-source-builder/rtems/sources/gdb-7.11.tar.xz
+ /usr/bin/tar -xvvf -
/Users/peer/projects/grisp/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gdb-7.11-x86_64-apple-darwin14.5.0-1/doit: line 86: /usr/local/bin/xz: No such file or directory
+ cd gdb-7.11
/Users/peer/projects/grisp/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gdb-7.11-x86_64-apple-darwin14.5.0-1/doit: line 87: cd: gdb-7.11: No such file or directory
shell cmd failed: /bin/sh -ex  /Users/peer/projects/grisp/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gdb-7.11-x86_64-apple-darwin14.5.0-1/doit
error: building arm-rtems4.12-gdb-7.11-x86_64-apple-darwin14.5.0-1

A call to /usr/local/bin/xz is used. But on the affected system xz is located at /opt/local/bin/xz:

$ type xz
xz is hashed (/opt/local/bin/xz)

Error build GDB

Trying to build the toolchain from scratch on a new machine, and getting this failure:

shell cmd failed: /bin/sh -ex  /Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gdb-7.12-x86_64-apple-darwin17.0.0-1/doit
error: building arm-rtems4.12-gdb-7.12-x86_64-apple-darwin17.0.0-1

(Full report: rsb-report-arm-rtems4.12-gdb-7.12-x86_64-apple-darwin17.0.0-1.txt)

Running that command manually fails with actual errors:

/usr/bin/c++ -O2 -pipe -fbracket-depth=1024 -I/Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-source-builder/rtems/build/tmp/sb-alind/4.12/rtems-arm/Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-install/rtems-4.12/include -g -O2   -I. -I../../gdb-7.12/gdb -I../../gdb-7.12/gdb/common -I../../gdb-7.12/gdb/config -DLOCALEDIR="\"/Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-install/rtems-4.12/share/locale\"" -DHAVE_CONFIG_H -I../../gdb-7.12/gdb/../include/opcode -I../../gdb-7.12/gdb/../opcodes/.. -I../../gdb-7.12/gdb/../readline/.. -I../../gdb-7.12/gdb/../zlib -I../bfd -I../../gdb-7.12/gdb/../bfd -I../../gdb-7.12/gdb/../include -I../libdecnumber -I../../gdb-7.12/gdb/../libdecnumber  -I../../gdb-7.12/gdb/gnulib/import -Ibuild-gnulib/import   -DTUI=1  -I/Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-source-builder/rtems/build/tmp/sb-alind/4.12/rtems-arm/Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-install/rtems-4.12/include  -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wformat-nonliteral  -c -o cp-namespace.o -MT cp-namespace.o -MMD -MP -MF .deps/cp-namespace.Tpo ../../gdb-7.12/gdb/cp-namespace.c
../../gdb-7.12/gdb/doublest.c:258:19: error: use of undeclared identifier 'min'; did you mean 'fmin'?
      mant_bits = min (mant_bits_left, 32);
                  ^~~
                  fmin
/Library/Developer/CommandLineTools/usr/include/c++/v1/math.h:1193:1: note: 'fmin' declared here
fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
In file included from ../../gdb-7.12/gdb/frame-base.c:20:
In file included from ../../gdb-7.12/gdb/defs.h:28:
../../gdb-7.12/gdb/common/common-defs.h:47:9: warning: '__STDC_CONSTANT_MACROS' macro redefined [-Wmacro-redefined]
#define __STDC_CONSTANT_MACROS 1
        ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdint.h:116:12: note: previous definition is here
#   define __STDC_CONSTANT_MACROS
           ^
In file included from ../../gdb-7.12/gdb/frame-base.c:20:
In file included from ../../gdb-7.12/gdb/defs.h:28:
../../gdb-7.12/gdb/common/common-defs.h:48:9: warning: '__STDC_LIMIT_MACROS' macro redefined [-Wmacro-redefined]
#define __STDC_LIMIT_MACROS 1
        ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdint.h:113:12: note: previous definition is here
#   define __STDC_LIMIT_MACROS
           ^
../../gdb-7.12/gdb/doublest.c:568:19: error: use of undeclared identifier 'min'; did you mean 'fmin'?
      mant_bits = min (mant_bits_left, 32);
                  ^~~
                  fmin
/Library/Developer/CommandLineTools/usr/include/c++/v1/math.h:1193:1: note: 'fmin' declared here
fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
../../gdb-7.12/gdb/doublest.c:912:25: error: use of undeclared identifier 'min'; did you mean 'fmin'?
      memcpy (to, from, min (TYPE_LENGTH (from_type), TYPE_LENGTH (to_type)));
                        ^~~
                        fmin
/Library/Developer/CommandLineTools/usr/include/c++/v1/math.h:1193:1: note: 'fmin' declared here
fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
^
6 warnings and 3 errors generated.

(Full log: gdb-doit.log)

Any suggestions?

Missing Licence

I would like to use this project as a base on another opensource but there is no license on this repo.

See how we can improve the error messages in bootloader

When mounting fails we only get a timeout message.

This is caused by the RTEMS media listener which waits for a SD card and then calls a callback.
Currently its unknown how we can differentiate between a timeout to detect a SD card and a mount error due to e.g. wrong filesystem types.

This needs some research or possibly extension to RTEMS media listener probably.

Built-in shell hangs after editing file

When editing a file on the SD-card the built-in RTEMS shell hangs aftewards. Steps to reproduce (using boot loader 1.0.1):

  1. Create a SD-card with a grisp.ini file that points out a non-existing binary to boot from

  2. Edit that file in the RTEMS shell started after boot fails:

    [/] # edit /media/mmcsd-0-0/grisp.ini
    
  3. Save it and quit (Ctrl+S and then Ctrl+Q)

  4. Try to see the changes:

    [/] # cat /media/mmcsd-0-0/grisp.ini
    

At this point, the shell freezes and does not recover. Before trying to edit or print the edited file, other commands seems to work (ls etc.).

Testsuite build: undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'

When trying to build current master ac07015 on MacOSX 10.12.6 I get errors in the testsuite:

[2152/2207] Compiling testsuite/usb01/init.c
[2153/2207] Compiling testsuite/usbkbd01/init.c
[2154/2207] Compiling testsuite/usbmouse01/init.c
[2155/2207] Compiling testsuite/usbserial01/init.c
[2156/2207] Compiling testsuite/vlan01/test_main.c
[2157/2207] Compiling testsuite/zerocopy01/test_main.c
[2158/2207] Linking build/arm-rtems4.12-atsamv/arphole.exe
[2159/2207] Linking build/arm-rtems4.12-atsamv/cdev01.exe
[2160/2207] Linking build/arm-rtems4.12-atsamv/commands01.exe
[2161/2207] Linking build/arm-rtems4.12-atsamv/condvar01.exe
[2162/2207] Linking build/arm-rtems4.12-atsamv/debugger01.exe
[2163/2207] Linking build/arm-rtems4.12-atsamv/dhcpcd01.exe
[2164/2207] Linking build/arm-rtems4.12-atsamv/dhcpcd02.exe
[2165/2207] Linking build/arm-rtems4.12-atsamv/evdev01.exe
[2166/2207] Linking build/arm-rtems4.12-atsamv/foobarclient.exe
[2167/2207] Linking build/arm-rtems4.12-atsamv/foobarserver.exe
[2168/2207] Linking build/arm-rtems4.12-atsamv/ftpd01.exe
testsuite/evdev01/init.c.200.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/arphole/test_main.c.193.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/dhcpcd02/test_main.c.199.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/dhcpcd01/test_main.c.198.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/debugger01/test_main.c.197.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/foobarclient/test_main.c.201.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/foobarserver/test_main.c.202.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

testsuite/ftpd01/test_main.c.203.o:(.rtemsroset.bsd.nexus.content.1+0x24): undefined reference to `_bsd_at91_mci_nexusmodule_sys_init'
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/opt/grisp/ac07015/grisp-software/rtems-libbsd/build/arm-rtems4.12-atsamv'
Build failed
 -> task in 'evdev01.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'arphole.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'dhcpcd02.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'dhcpcd01.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'debugger01.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'foobarclient.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'foobarserver.exe' failed with exit status 1 (run with -v to display more information)
 -> task in 'ftpd01.exe' failed with exit status 1 (run with -v to display more information)

GCC no longer builds on macOS 10.13

Build fails with the master version of the toolchain on macOS 10.13.1. GCC fails to build with the error message:

...
arm-rtems4.12/eb/thumb/armv7-r/libstdc++-v3/include/bits/move.h:54:10: fatal error: type_traits: No such file or directory
 #include <type_traits> // Brings in std::declval too.
          ^~~~~~~~~~~~~
compilation terminated.
make[8]: *** [bad_array_new.lo] Error 1
make[8]: *** Waiting for unfinished jobs....
make[7]: *** [all-recursive] Error 1
make[6]: *** [all] Error 2
make[5]: *** [multi-do] Error 1
make[4]: *** [all-multi] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libstdc++-v3] Error 2
make: *** [all] Error 2
shell cmd failed: /bin/sh -ex  /Users/alind/Stritzinger/Code/GRiSP/grisp-software/rtems-source-builder/rtems/build/arm-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-apple-darwin17.2.0-1/doit
error: building arm-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-apple-darwin17.2.0-1

This is a full ./build/build.sh after running git clean -fXd && git clean -fxd && git submodule sync && git submodule update.

Full error report: rsb-report-arm-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-apple-darwin17.2.0-1.txt

Build tool details:

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Usage of PIO_ConfigureIt() leads to wpa_supplicant not starting

In my application I try to register an interrupt. As soon as I use the function PIO_ConfigureIt() wpa_supplicant fails to start, even when the function is not called at all. So I guess that something is linked automaticly which interferes with wpa_supplicant.

Boot output looks as follows:

mkdir /tmp
mkdir /tmp/log
mkdir /home
err: Setting environment
nchdir(/media/mmcsd-0-0/)
o
erl_main: starting ...
 getcwd: /media/mmcsd-0-0
vhostname: grispapp
astarting erlang runtime
lid interfaces found
warning: no interfaces have a carrier
uhub0: 2 ports with 2 removable, self powered
Successfully initialized wpa_supplicant
ugen0.2: <Philips Semiconductors ISP1520> at usbus0
uhub1 on uhub0
uhub1: <Philips Semiconductors ISP1520, class 9/0, rev 2.00/0.00, addr 2> on usbus0
uhub1: 3 ports with 3 removable, self powered
ugen0.3: <vendor 0x0bda product 0x8176> at usbus0
rtwn0: <vendor 0x0bda product 0x8176, class 0/0, rev 2.00/2.00, addr 3> on usbus0
rtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R
wlan0: Failed to initialize driver interface
wpa_supplicant returned with -1
Successfully initialized wpa_supplicant
wlan0: Failed to initialize driver interface
wpa_supplicant returned with -1
Successfully initialized wpa_supplicant
wlan0: Failed to initialize driver interface
wpa_supplicant returned with -1
Successfully initialized wpa_supplicant```

Bootloader complains about entries in grisp.ini file it doesn't know

Adding a section [network] with a value results in errors in the ini parser of the bootloader e.g.

boot: error in configuration file: section "network", name "foo", value "bar"

It would be nice if we could use one ini file for bootloader things and application startup things
but these error messages are confusing.

Unknown sections should be ignored, maybe also unknown values in known sections.

Consider hosting rtems toolchain build-dependencies on GitHub

It appears that some patches the rtems toolchain build process depends on are hosted on an unreliable server. Maybe consider hosting them GitHub or removing them altogether as they appear to be irrelevant for the ARM toolchain build?

grisp-software/build/build.sh

[...]
config: tools/rtems-gdb-8.0.1-1.cfg
package: arm-rtems5-gdb-8.0.1-x86_64-linux-gnu-1
download: http://ftp.gnu.org/gnu/gdb/gdb-8.0.1.tar.xz -> sources/gdb-8.0.1.tar.xz
downloading: sources/gdb-8.0.1.tar.xz - 18.7MB of 18.7MB (100%)
download: https://gaisler.org/gdb/gdb-8.0.1-sis-leon2-leon3.diff -> patches/gdb-8.0.1-sis-leon2-leon3.diff
download: https://gaisler.org/gdb/gdb-8.0.1-sis-leon2-leon3.diff: error: <urlopen error [Errno 111] Connection refused>
error: downloading https://gaisler.org/gdb/gdb-8.0.1-sis-leon2-leon3.diff: all paths have failed, giving up
Build FAILED
  See error report: rsb-report-arm-rtems5-gdb-8.0.1-x86_64-linux-gnu-1.txt
error: downloading https://gaisler.org/gdb/gdb-8.0.1-sis-leon2-leon3.diff: all paths have failed, giving up

Add instructions of how to create custom RTEMS binaries

We should have instructions of how to use the toolchain to build a custom RTEMS binary to run on the board, from scratch or with some existing C code (i.e. what we do to get the Erlang VM to run, but with some other C project).

Updating the booloader on macOS 10.13.1

./build/build-openocd.sh fails:

+ tar -xaf /Users/.../GRiSP/grisp-software/build/src/openocd-0.10.0.tar.bz2
Usage:
  List:    tar -tf <archive-filename>`
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help

At least some time intervals are wrong on the Erlang level

When I call:

timer:sleep(10000).

It takes 20s instead of 10s to wake up.

> T1 = erlang:now().

... wait for 10s

> T2 = erlang:now().
> timer:now_diff(T2,T1)/1000000.
5.206791

The same goes for:

> T1 = os:timestamp().

... wait for 10s

> T2 = os:timestamp().
> timer:now_diff(T2,T1)/1000000.
5.177451

Looking at some of the new time functions:

> erlang:system_info(os_system_time_source).
[{function,clock_gettime},
 {clock_id,'CLOCK_REALTIME'},
 {resolution,1000000000},
 {parallel,yes},
 {time,568460484965710933}]

... wait 10s

> erlang:system_info(os_system_time_source).
[{function,clock_gettime},
 {clock_id,'CLOCK_REALTIME'},
 {resolution,1000000000},
 {parallel,yes},
 {time,568460490123233905}]
> 568460484965710933-568460490123233905.
-5157522972
> (568460484965710933-568460490123233905)/1000000000.
-5.157522972000001

It looks very much that all the times are consistently off by a factor of two. @c-mauderer reported quite a while ago that they checked the RTEMS POSIX time functions and they work correctly so there is something weird going on here which we need to look into.

Use "." instead of "source" in shell scripts since the latter is not POSIX conformant

I just tried to setup the buildchain in Ubuntu 16.04. When running `./build/build.sh' it complains:

source /home/kilian/grisp-software/build/configuration.sh
./build/build.sh: 13: ./build/build.sh: source: not found

Whereas if I run with bash ./build/build.sh it starts off nice, but fails at a later point, where it runs again into a similar error.

So i think all hashbangs should be changed to #! /usr/bin/env bash.

See also: https://stackoverflow.com/questions/670191/getting-a-source-not-found-error-when-using-source-in-a-bash-script

In Fedora (also an many other OSs) sh defaults to bash.
In Ubuntu sh defaults to dash.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.