Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi optimizations and libbsd to FreeBSD 12 update #46

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

sebhub
Copy link
Contributor

@sebhub sebhub commented Oct 4, 2018

This pull requests updates the libbsd to a FreeBSD baseline close to the FreeBSD 12 release (2018-09-17). This requires an RSB and RTEMS update as well.

The saf1761_otg driver uses now a real interrupt handler for the saf1761_otg_filter_interrupt() function which reduces the amount of task switches to the interrupt server.

An mbuf alignment was fixed in the rtwn driver receive path to avoid unnecessary data movements.

Task stacks moved to the internal SRAM in the grisp-sd-sample. This improves TCP throughput by about 100KiB/s.

curl -o /dev/null ftp://anonymous@192.168.178.27/dev/zero
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 104M 0 0 485k 0 --:--:-- 0:03:39 --:--:-- 542k

curl -T /dev/zero ftp://anonymous@192.168.178.27/dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 76.2M 0 0 0 76.2M 0 593k --:--:-- 0:02:11 --:--:-- 606k

The signal quality has a huge impact on the throughput. This makes measurements quite uncertain.

The rtwn transmit path uses m_copydata() which uses bcopy() which is a memmove(). There is no specialized memmove() implementation for ARMv7-M in Newlib (unlike to memcpy()). This is a slight performance penalty.

This reduces the amount of task switches in libbsd and thus improves
throughput.
Enable a custom stack allocator which uses the internal SRAM for the
task stacks if available.
@eproxus eproxus requested review from sylane and peerst October 8, 2018 07:58
@lin7sh
Copy link

lin7sh commented Dec 21, 2018

Any progress on this, Freebsd12-release has published a few days ago

@peerst
Copy link
Contributor

peerst commented Dec 22, 2018

Any progress on this, Freebsd12-release has published a few days ago

Are you having issues that you hope to be fixed by this @mko-io ?

@peerst
Copy link
Contributor

peerst commented Dec 22, 2018

Task stacks moved to the internal SRAM in the grisp-sd-sample. This improves TCP throughput by about 100KiB/s.

@sebhub I fail to see how this is done. All I see some smaller stacks and the inclusion of stackalloc.h

We would like to replicated this for the GRiSP image too (in addition to moving heavily used RTEMS and Erlang modules into internal SRAM once we figure out how that is done -- hints welcome ;-)

@lin7sh
Copy link

lin7sh commented Dec 22, 2018

@peerst no, I just curious about whether the new Freebsd release would improve grisp or not

@peerst
Copy link
Contributor

peerst commented Jan 3, 2019

@mko-io I don't expect FreeBSD 12 to bring much new things for us. This PR is mainly about the WiFi and other optimisations which just happen to be made on the latest libbsd, which happens to be based on FreeBSD 12.

What we would get is all security updates since the last update of libbsd if there are any in the kernel network stack.

@sebhub
Copy link
Contributor Author

sebhub commented Jan 3, 2019

The libbsd upstream is based on FreeBSD head 2018-12-20. The FreeBSD 12 release was 2018-12-11:

https://www.freebsd.org/releases/12.0R/announce.html

It includes an update of wpa_supplicant to version 2.7.

It includes an update of the OpenSSL baseline to version 1.1.1a.

@sebhub
Copy link
Contributor Author

sebhub commented Jan 3, 2019

Task stacks moved to the internal SRAM in the grisp-sd-sample. This improves TCP throughput by about 100KiB/s.

@sebhub I fail to see how this is done. All I see some smaller stacks and the inclusion of stackalloc.h

We would like to replicated this for the GRiSP image too (in addition to moving heavily used RTEMS and Erlang modules into internal SRAM once we figure out how that is done -- hints welcome ;-)

The inclusion of <bsp/stackalloc.h> in the configuration source file just enables a custom stack allocator. It uses the internal SRAM. The earlier a task is created the more likely its task stack is allocated from the internal SRAM. An alternative would be to use POSIX threads with a user defined task stack or a new API for Classic tasks which allow a user defined stack.

@holzingk
Copy link
Contributor

holzingk commented Jan 7, 2019

Builds fine on Linux, but still having issues on macOS, need to have a closer look...

@lin7sh
Copy link

lin7sh commented Jan 7, 2019

@peerst I've read about Freebsd has some improvement on MMC/SDIO stack (base on CAM), does this mean we can use SDIO based wifi chip on grisp board?

@c-mauderer
Copy link
Collaborator

@peerst I've read about Freebsd has some improvement on MMC/SDIO stack (base on CAM), does this mean we can use SDIO based wifi chip on grisp board?

A note regarding that from me: We had a GSoC student in 2018 who worked on the topic of using the FreeBSD-SDIO stack on RTEMS. He had some success on a Beagle Bone Black with a normal SD storage card. But there was still some work left. I would expect that about the following would be necessary:

  • Port SDIO stack via libbsd (part of the GSoC work should be re-usable).
  • Adapt the Atsam SD-Card driver so that it works with the new stack.

So SDIO WLAN modules should theoretically be possible but they would need quite some work.

@eproxus
Copy link
Member

eproxus commented Jan 14, 2019

@sebhub @c-mauderer I'm having trouble building this toolchain version on macOS 10.14.2:

../../gcc-7.3.0/gcc/graphite-optimize-isl.c:57:19: error: use of undeclared identifier 'isl_space_dim'
  unsigned dims = isl_space_dim (space, isl_dim_set);
                  ^
../../gcc-7.3.0/gcc/graphite-optimize-isl.c:60:3: error: use of undeclared identifier 'isl_space_free'
  isl_space_free (space);
  ^

This could be related https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724

It's quite possible that GCC 7.3.0 does not play nice with ISL 0.20 / whatever is installed in macOS 10.13... Any suggestions?

@c-mauderer
Copy link
Collaborator

The branch has already slightly fallen behind RTEMS upstream. Sebastian updated gcc to 7.4.0 in Dezember. Would you expect that 7.4.0 would work? In that case it might would be a good idea to update rtems, libbsd and rsb in this branch and try with that.

@eproxus
Copy link
Member

eproxus commented Jan 14, 2019

@c-mauderer It seems it should be fine in 7.4 according to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724#c6

Richard Biener 2018-08-01 08:08:08 UTC:
Fixed for GCC 7.4+.

So it sounds like a good idea to update all of them to the latest version.

@eproxus
Copy link
Member

eproxus commented Jan 14, 2019

@c-mauderer Can you tell me how to do that, or help me do it?

@c-mauderer
Copy link
Collaborator

To update the submodules, the following steps are necessary (written out of my head so no guarantee for no typos):

  • go into the submodules directory
  • Update the mirror of the remote repository on github
    • go to the submodule directory and add a remote for the official repo at git.rtems.org (git remote add rtems git://git.rtems.org/rtems.git - adapt rtems.git for the other submodules)
    • fetch the latest changes from git.rtems.org and push them to the GRiSP mirror repo (git fetch rtems and git push origin rtems/master:master assuming you didn't change the name of origin)
  • check out the master from the github mirror (git co origin/master)
  • repeat for other submodules
  • do a git st in grisp-software - it should tell you that the submodules have been changed
  • you can now add and commit the changed submodules and try whether everything still builds

@c-mauderer
Copy link
Collaborator

Note that you should always use rtems, rtems-libbsd and rtems-source-builder from about the same date. Sometimes there are dependencies - especially from libbsd to newlib and rtems.

@eproxus
Copy link
Member

eproxus commented Jan 14, 2019

@c-mauderer Got further this time, but another error appeared when compiling GCC 7.4.0:

/arm-rtems5/eb/thumb/armv7-r/vfpv3-d16/hard/libstdc++-v3/include/bits/locale_facets.h:41:10: fatal error: bits/ctype_base.h: No such file or directory
 #include <bits/ctype_base.h>
          ^~~~~~~~~~~~~~~~~~~

Some casual searching suggests libstdc++ is not available in macOS Mojave (10.14)...

@eproxus
Copy link
Member

eproxus commented Jan 14, 2019

Seems Apple decided to remove /usr/include in the upgrade to macOS Mojave (!). Following the instructions here solved the error above: https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave

Next problem (or is it the build successful?) is this:

...
Checking for RTEMS_POSIX_API                : yes
Checking for RTEMS_SMP                      : no
Checking for RTEMS_NETWORKING               : no
Checking for header dlfcn.h                 : yes
Checking for header rtems/pci.h             : yes
Configure variant:                          : arm-rtems5-atsamv-grisp
Checking for header rtems/rtems-debugger.h  : yes
'configure' finished successfully (0.978s)
+ waf
Could not create the directory ///o

@c-mauderer
Copy link
Collaborator

I'm not entirely sure because it is missing some context but I would assume that RTEMS did build fine but the libbsd build went wrong. Can you do three things:

  1. There is now a known working version of waf checked in into libbsd. Use that version.
  2. Add a -v to the waf call.
  3. Re-run ./build/build-libbsd.sh

Basically 1 and 2 would be the following changes:

diff --git a/build/build-libbsd.sh b/build/build-libbsd.sh
index 61bc009..909499f 100755
--- a/build/build-libbsd.sh
+++ b/build/build-libbsd.sh
@@ -55,15 +55,15 @@ then
        fi
 fi
 
-waf configure \
+./waf configure \
        --prefix="${PREFIX}" \
        --rtems-bsps="${RTEMS_CPU}/${BSP_NAME}" \
        --buildset="${SCRIPTDIR}/libbsd-buildset.ini"
-waf
+./waf -v
 
 if [ $DO_INSTALL -ne 0 ]
 then
-       waf install
+       ./waf install
 fi
 
 if [ "$BSP_NAME" = "atsamv" ]

The -v should be removed after the problem is solved. The other changes would be good to keep.

@eproxus
Copy link
Member

eproxus commented Jan 15, 2019

@c-mauderer You're correct that it was in the libbsd build. Unfortunately the waf change didn't solve it:

'configure' finished successfully (1.272s)
+ ./waf -v
Could not create the directory ///o

Full output here: https://gist.github.com/eproxus/2b60f59c50ac74f05c3c93147ef58d27

@c-mauderer
Copy link
Collaborator

Somehow I remember that I had that output once too. I'm currently not sure when or why. Could you try to clean the rtems-libbsd directory? For that I would suggest the command git clean -dxn inside the libbsd directory. That shows a list with files that git wants to delete. That should be the build directory and some waf specific stuff. If the output sounds reasonable, you can replace the n by an f to really delete all listed files.

@eproxus
Copy link
Member

eproxus commented Jan 15, 2019

@c-mauderer After cleaning the repo from scratch with git clean -fXd and git clean -fxd including all submodules I still get the same error.

@c-mauderer
Copy link
Collaborator

Do you have the branch somewhere so that I could try a build on my Linux machine?

@eproxus
Copy link
Member

eproxus commented Jan 16, 2019

@c-mauderer Pushed my changes to eproxus/wifi-opti-and-libbsd-to-freebsd-12-update

@holzingk
Copy link
Contributor

@sebhub @c-mauderer Do you know the source of the failure?
https://20-67125809-gh.circle-artifacts.com/0/tmp/rsb-reports/rsb-report-arm-rtems5-gcc-7.3.0-newlib-d13c84eb07e35984bf7a974cd786a6cdac29e6b9-x86_64-linux-gnu-1.txt

I think it is connected to limited RAM of 4GB inside the Docker container of the CI system. We are currently requesting more from CircleCI.

@eproxus
Copy link
Member

eproxus commented Mar 11, 2019

@nextl00p Could be the OOM killer in Linux

@c-mauderer
Copy link
Collaborator

I would too assume the OOM killer. Compiling gcc needs quite a lot of memory. And it seems that some process (most likely cc1plus) has been killed and therefore the output stream has been aborted. That resulted in the {standard input}: Assembler messages:.

Do you have the possibility to get a dmesg output of the system? I think the OOM-killer is logged there.

@eproxus
Copy link
Member

eproxus commented Mar 12, 2019

@c-mauderer @nextl00p You can debug with SSH: https://circleci.com/docs/2.0/ssh-access-jobs/

@sebhub
Copy link
Contributor Author

sebhub commented Mar 20, 2019

If you plan to integrate these changes, I recommend to update to the libbsd/5-freebsd-12 branch. This branch tracks FreeBSD stable/12.

@eproxus
Copy link
Member

eproxus commented Mar 20, 2019

The problems I'm having might be related to this bug: https://devel.rtems.org/ticket/3709

Note: Python 3 is now needed to build libbsd (because of the bug
https://devel.rtems.org/ticket/3709).
@eproxus
Copy link
Member

eproxus commented Mar 26, 2019

Note: Python 3 is now (temporarily) needed to build libbsd as a workaround for https://devel.rtems.org/ticket/3709

@sebhub @c-mauderer Can you confirm my latest commit looks okay, in regards to the versions used of RTEMS, libbsd and RTEMS source builder?

Revert "Test OTP build with new toolchain"
This reverts commit cd73e8f.

Revert "Add dmesg output to CI artifacts"
This reverts commit 7f51e9e.

Revert "Store rsb-report artifact when build fails"
This reverts commit 81dd5fd.

Revert "Add status badge"
This reverts commit bed8dd7.

Revert "Add CircleCI config"
This reverts commit a56f8f5.
@c-mauderer
Copy link
Collaborator

@eproxus: Are you sure you want to switch back to the upstream repository instead of mirroring the branches in your repo?

@eproxus
Copy link
Member

eproxus commented Mar 26, 2019

@c-mauderer Since some sub repos point to git.rtems.org anyway, there's no point in having our own forks for just some repositories, right?

@c-mauderer
Copy link
Collaborator

I think the only one left pointing to git.rtems.org has been the rtems_waf in libbsd.

Please don't understand me wrong: I'm OK with the repos pointing to git.rtems.org. I think the original change was due to some server outage on the RTEMS server. I'm sure that happens more often than an outage on github.

@c-mauderer
Copy link
Collaborator

PS: Maybe it would be good then to somehow mark the mirrored repos to only be left in the GRiSP project for building old versions (especially the ones that used the grisp-branches). No idea how to do that on github but I'm sure there is something that can be done.

@eproxus
Copy link
Member

eproxus commented Mar 26, 2019

@c-mauderer I thought so as well, but didn't like the idea of having a separate branch of libbsd master just to be able to point to a fork of rtems_waf as well. It gets recursively messy 😕

You can mark repositories as no longer active/maintained somehow. I'll do that in that case.

@c-mauderer
Copy link
Collaborator

I had suggested once that we use a relative URL for rtems_waf in libbsd. But then I noted that the git version used in old but still maintained CentOS versions can't handle these. So the absolute URL has been left. Maybe in a distant future when even a distribution like CentOS handles the relative URLs we will change that in libbsd ;-)

Please mark the repos only after the merge.

@eproxus
Copy link
Member

eproxus commented Mar 26, 2019

Yeah, sounds good. There are so many external dependencies in this toolchain anyway, so having one more is fine for now. We don't build that often.

@eproxus
Copy link
Member

eproxus commented Mar 10, 2020

Trying to attack this again now, and am following this procedure on macOS 10.15.3 (using Homebrew for all the dependencies):

  1. mkdir -p /opt/grisp/grisp-software
  2. cd /opt/grisp/grisp-software
  3. git clone https://github.com/grisp/grisp-software.git -b eproxus/wifi-opti-and-libbsd-to-freebsd-12-update tmp
  4. mv tmp 02e43314de
  5. cd 02e43314de
  6. ./build/build.sh

It fails building libgrisp with the following error:

/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(rtwn_usb_reg.c.19.o): in function `_bsd_rtwn_usb_delay':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/dev/rtwn/usb/rtwn_usb_reg.c:178: undefined reference to `MSEC_2_TICKS'
Output
+ /opt/grisp/grisp-software/8f7399b9b7/build/build-libgrisp.sh
+ set -e -u
++ readlink -- /opt/grisp/grisp-software/8f7399b9b7/build/build-libgrisp.sh
++ echo /opt/grisp/grisp-software/8f7399b9b7/build/build-libgrisp.sh
+ SCRIPTPATH=/opt/grisp/grisp-software/8f7399b9b7/build/build-libgrisp.sh
+++ dirname -- /opt/grisp/grisp-software/8f7399b9b7/build/build-libgrisp.sh
++ CDPATH=
++ cd -- /opt/grisp/grisp-software/8f7399b9b7/build
++ pwd
+ SCRIPTDIR=/opt/grisp/grisp-software/8f7399b9b7/build
+ PROJECTDIR=/opt/grisp/grisp-software/8f7399b9b7/build/../
+ . /opt/grisp/grisp-software/8f7399b9b7/build/configuration.sh
++ BSP_NAME=atsamv
++ RTEMS_CPU=arm
++ RTEMS_VERSION=5
++ TARGET=arm-rtems5
++ PREFIX=/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems-install/rtems/5/
+++ git rev-parse HEAD
++ TOOLCHAIN_REVISION=8f7399b9b722f3d048d1f2e0a5f1ac757ecc737d
++ RTEMS_SOURCE_DIR=/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems
++ LIBBSD_SOURCE_DIR=/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems-libbsd
++ LIBINIH_SOURCE_DIR=/opt/grisp/grisp-software/8f7399b9b7/build/..//libinih
++ LIBGRISP_SOURCE_DIR=/opt/grisp/grisp-software/8f7399b9b7/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=/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems-install/rtems/5//bin:/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems-install/rtems/5//bin:/Users/alind/.asdf/shims:/Users/alind/.asdf/bin:/Users/alind/.local/bin:/Users/alind/.cache/rebar3/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/anaconda3/bin:/usr/local/anaconda3/condabin:/Users/alind/Code/go/bin:/Users/alind/.cargo/bin'
+ PATH='/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems-install/rtems/5//bin:/opt/grisp/grisp-software/8f7399b9b7/build/..//rtems-install/rtems/5//bin:/Users/alind/.asdf/shims:/Users/alind/.asdf/bin:/Users/alind/.local/bin:/Users/alind/.cache/rebar3/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/anaconda3/bin:/usr/local/anaconda3/condabin:/Users/alind/Code/go/bin:/Users/alind/.cargo/bin'
+ cd /opt/grisp/grisp-software/8f7399b9b7/build/..//libgrisp
+ make clean install
rm -rf b-atsamv
mkdir b-atsamv
mkdir b-atsamv/src
arm-rtems5-gcc --pipe  -Iinclude -MT b-atsamv/src/eeprom.o -MD -MP -MF b-atsamv/src/eeprom.d -B /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -c src/eeprom.c -o b-atsamv/src/eeprom.o
src/eeprom.c: In function 'grisp_eeprom_dump':
src/eeprom.c:126:9: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t {aka unsigned int}' [-Wformat=]
  printf("sig_version: %u\n"
         ^~~~~~~~~~~~~~~~~~~
src/eeprom.c:138:6:
      eeprom->serial,
      ~~~~~~~~~~~~~~
src/eeprom.c:127:17: note: format string is defined here
      "serial: %lu\n"
               ~~^
               %u
arm-rtems5-gcc --pipe  -Iinclude -MT b-atsamv/src/eeprom_crc.o -MD -MP -MF b-atsamv/src/eeprom_crc.d -B /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -c src/eeprom_crc.c -o b-atsamv/src/eeprom_crc.o
arm-rtems5-gcc --pipe  -Iinclude -MT b-atsamv/src/init.o -MD -MP -MF b-atsamv/src/init.d -B /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -c src/init.c -o b-atsamv/src/init.o
arm-rtems5-gcc --pipe  -Iinclude -MT b-atsamv/src/init_wpa.o -MD -MP -MF b-atsamv/src/init_wpa.d -B /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -c src/init_wpa.c -o b-atsamv/src/init_wpa.o
arm-rtems5-gcc --pipe  -Iinclude -MT b-atsamv/src/led.o -MD -MP -MF b-atsamv/src/led.d -B /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -c src/led.c -o b-atsamv/src/led.o
arm-rtems5-ar rcu b-atsamv/libgrisp.a b-atsamv/src/eeprom.o b-atsamv/src/eeprom_crc.o b-atsamv/src/init.o b-atsamv/src/init_wpa.o b-atsamv/src/led.o
arm-rtems5-ar: `u' modifier ignored since `D' is the default (see `U')
arm-rtems5-ranlib b-atsamv/libgrisp.a
mkdir -p /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/include/grisp
install -m 644 b-atsamv/libgrisp.a /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib
install -m 644 include/grisp/*.h /opt/grisp/grisp-software/8f7399b9b7/libgrisp/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/include/grisp
+ echo 8f7399b9b722f3d048d1f2e0a5f1ac757ecc737d
+ echo '#define GRISP_TOOLCHAIN_REVISION "8f7399b9b722f3d048d1f2e0a5f1ac757ecc737d"'
+ echo '-define(GRISP_TOOLCHAIN_REVISION, "8f7399b9b722f3d048d1f2e0a5f1ac757ecc737d").'
+ cd /opt/grisp/grisp-software/8f7399b9b7/build/..//grisp-bootloader
+ make clean all
rm -rf b-atsamv
mkdir b-atsamv
arm-rtems5-gcc --pipe  -MT b-atsamv/init.o -MD -MP -MF b-atsamv/init.d -B /opt/grisp/grisp-software/8f7399b9b7/grisp-bootloader/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -O2 -DGRISP_BL_VERSION="\"bootloader-V1.0.1-35-g8f73-dirty\"" -DGRISP_BL_BUILD_DATE="\"Mon Mar  9 18:32:53 UTC 2020\"" -c init.c -o b-atsamv/init.o
arm-rtems5-gcc --pipe -B /opt/grisp/grisp-software/8f7399b9b7/grisp-bootloader/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -Wl,--gc-sections -qnolinkcmds -T linkcmds.bootloader -O2 -g -ffunction-sections -fdata-sections -Wl,-Map,b-atsamv/bootloader.map b-atsamv/init.o -lgrisp -linih -lbsd -lm -o b-atsamv/bootloader.exe
+ cd /opt/grisp/grisp-software/8f7399b9b7/build/..//grisp-fatbench
+ make clean all
rm -rf b-atsamv
mkdir b-atsamv
arm-rtems5-gcc --pipe  -MT b-atsamv/fatbench.o -MD -MP -MF b-atsamv/fatbench.d -B /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -O0 -c fatbench.c -o b-atsamv/fatbench.o
arm-rtems5-gcc --pipe  -MT b-atsamv/init.o -MD -MP -MF b-atsamv/init.d -B /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -O2 -g -ffunction-sections -fdata-sections -O0 -c init.c -o b-atsamv/init.o
arm-rtems5-gcc --pipe -B /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib -specs bsp_specs -qrtems -mthumb -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -Wl,--gc-sections -qnolinkcmds -T linkcmds.sdram -O2 -g -ffunction-sections -fdata-sections -Wl,-Map,b-atsamv/fatbench.map b-atsamv/fatbench.o b-atsamv/init.o -lgrisp -lbsd -lm -o b-atsamv/fatbench.exe
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(rtwn_usb_reg.c.19.o): in function `_bsd_rtwn_usb_delay':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/dev/rtwn/usb/rtwn_usb_reg.c:178: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_amrr.c.19.o): in function `amrr_setinterval':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_amrr.c:113: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_amrr.c.19.o): in function `amrr_sysctl_interval':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_amrr.c:452: undefined reference to `TICKS_2_MSEC'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_amrr.c.19.o): in function `amrr_setinterval':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_amrr.c:113: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_amrr.c:113: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_freebsd.c.19.o): in function `_bsd_ieee80211_sysctl_msecs_ticks':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_freebsd.c:138: undefined reference to `TICKS_2_MSEC'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_freebsd.c:144: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_freebsd.c.19.o): in function `_bsd_ieee80211_com_vdetach':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_freebsd.c:348: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_node.c.19.o): in function `ieee80211_erp_timeout':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_node.c:2882: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_scan_sta.c.19.o): in function `sta_start':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_scan_sta.c:760: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_scan_sta.c:758: undefined reference to `MSEC_2_TICKS'
/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(ieee80211_scan_sta.c.19.o):/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/net80211/ieee80211_scan_sta.c:1561: more undefined references to `MSEC_2_TICKS' follow
collect2: error: ld returned 1 exit status
make: *** [b-atsamv/fatbench.exe] Error 1

@c-mauderer @sebhub Any ideas?

@c-mauderer
Copy link
Collaborator

It could be a non-matching RTEMS and libbsd version. The MSEC_2_TICKS has been added in commit c6d8589bb00a9d2a5a094c68c90290df1dc44807 in RTEMS into cpukit/include/machine/_kernel_time.h. I assume that libbsd would use that definition.

@sebhub
Copy link
Contributor Author

sebhub commented Mar 11, 2020 via email

@eproxus
Copy link
Member

eproxus commented Mar 11, 2020

@c-mauderer Any idea how that could have happened? I haven't changed the versions since last time (only I'm now testing on macOS 10.15). Newbie question: How can I check which version of RTEMS I'm using?

@c-mauderer
Copy link
Collaborator

@c-mauderer Any idea how that could have happened? I haven't changed the versions since last time (only I'm now testing on macOS 10.15).

Not really. It's also just a guess that it could be a version mismatch.

I looked back at your commands:

  • mv tmp 02e43314de

  • cd 02e43314de

and

/opt/grisp/grisp-software/8f7399b9b7/rtems-install/rtems/5/lib/gcc/arm-rtems5/7.4.0/../../../../arm-rtems5/bin/ld: /opt/grisp/grisp-software/8f7399b9b7/grisp-fatbench/../rtems-install/rtems/5/arm-rtems5/atsamv/lib/libbsd.a(rtwn_usb_reg.c.19.o): in function `_bsd_rtwn_usb_delay':
/opt/grisp/grisp-software/8f7399b9b7/rtems-libbsd/build/arm-rtems5-atsamv-grisp/../../freebsd/sys/dev/rtwn/usb/rtwn_usb_reg.c:178: undefined reference to `MSEC_2_TICKS'

There is a mismatch in the folder name. Just to make sure: Did you build the version that you wanted to build or is there a mismatch for some reason?

Newbie question: How can I check which version of RTEMS I'm using?

First you can take a look at version you checked out. But I assume that you do know that method and therefore you are searching for a method to analyze the generated binaries?

Since 2017 we have a version API:
https://docs.rtems.org/doxygen/branches/master/group__ClassicVersion.html
So in software you can use rtems_version() in an application to get a version string.

Another method is to analyze the binary files. You want the content of rtems_version from version.o which is linked into librtemscpu.a. I'm sure there is a nice objdump or readelf command for that. But the simplest method I found is to use strings (note: this is for another BSP - adapt your path):

> strings rtems/5/arm-rtems5/imx7/lib/librtemscpu.a | grep '5\.0\.0\.'
5.0.0.7cb8d066fea89d2b4844ff760ca2a3b053d7f901

@eproxus
Copy link
Member

eproxus commented Mar 12, 2020

@c-mauderer Sorry, my bad. The correct hash is of course 8f7399b. I'm building this PR branch directly (not my old fork).

This is what my submodules show:

$ git submodule status
 d709bdac5b6bfa27c913d3a3e0e982d2c12217f2 libinih/inih (r36-13-gd709bda)
 7a1934dac087295b209563d984549a48728599a3 rtems (7a1934dac0)
 eb1d30ad351ed18116acbd8b224ed8e07d6627d0 rtems-libbsd (eb1d30ad)
 9c825f0b9a4eff4f87d22e12d3c94072712c3918 rtems-source-builder (9c825f0)

Something is fishy here. Not sure why we have RTEMS code from March 2019 (7a1934da) which depends on code from November 2019 (c6d8589b). That doesn't make sense.

@c-mauderer
Copy link
Collaborator

Something is fishy here. Not sure why we have RTEMS code from March 2019 (7a1934da) which depends on code from November 2019 (c6d8589b). That doesn't make sense.

Yes, you are right. That seems unlikely except if a long lasting bug has been fixed with it. But then it would be odd that it worked some-when in the past on my system...

Like @sebhub said:

Maybe we should test the Grisp stuff with the RTEMS 5.1 release candidate once it is available.

If you are thinking about that too, I would suggest to not take a too detailed look at the current problem but wait for the update instead.

@eproxus
Copy link
Member

eproxus commented Mar 18, 2020

@c-mauderer I'd rather get this PR out of the way first than upgrading RTEMS once again (especially to a version that is not released yet). I've confirmed that the submodules are their same old version from early 2019, how come we get references to some new RTEMS feature that we don't use? Could something newer been pulled in in a way that we don't have control over by the build script (e.g. not via submodules configuration, but some download or samething)?

@c-mauderer
Copy link
Collaborator

I did try to re-build the branch on my machine and I get the same error. I'm really not sure why the error occurs now. I'm not even sure whether the error did not occur after the last pushes to that branch. From what I can read in the history of this PR, I can't say that I tested these updates. So it's quite possible that it never worked.

Regarding the msecs_to_ticks: The error only occurs if someone links in WLAN. And I think it's quite possible that you are the only regular users of that. So the bug can be hidden since quite some time.

Again: I would suggest to do a step to a recent version where the error is already fixed instead of fixing it on this old version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants