Here are the steps to fix this:

  1. First uninstall gcc-arm-embedded from brew

       brew uninstall gcc-arm-embedded
  2. Install the toolchain by pulling it from ARM. Run these commands:

       cd ~
       wget "https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2"
       tar xvfj gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2
       rm gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2

    Note for Catalina users you will get an error when running these utilities for the first time. You must allow them to be executed in your Security preferences.

    Error running ARM Toolchain

  3. Finally you'll need export a few important environment variables for things to work. For bash here's the entry for .bash_profile that I have:

       # Zephyr related
       export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
       export GNUARMEMB_TOOLCHAIN_PATH="~/gcc-arm-none-eabi-9-2019-q4-major"

    πŸ’‘Note: this should also work for .zshrc for those folks who are using newer versions of Mac OS (or just plain prefer zsh)

    For folks using fish you're going to use:

       set -Ux ZEPHYR_TOOLCHAIN_VARIANT gnuarmemb
       set -Ux GNUARMEMB_TOOLCHAIN_PATH "~/gcc-arm-none-eabi-9-2019-q4-major"
  4. Close and reopen all terminals and Visual Studio Code.

  5. Try compiling again!


    Also remove any reference to CROSS_COMPILE in you .zshrc or .bash_profile or remove it in fish using set -e CROSS_COMPILE

      Hello,

      Ok this solved the initial issue.
      However now I have something like this error for some .h files

      #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/Users/louis/ncs/nrf/samples/nrf9160/gps/src/main.c).C/C++(1696)
      cannot open source file "inttypes.h" (dependency of "zephyr.h")C/C++(1696)
      
      cannot open source file "sys/types.h" (dependency of "nrf_socket.h")C/C++(1696)
      
      cannot open source file "sys/types.h" (dependency of "net/socket.h")C/C++(1696)
      
      cannot open source file "stdio.h"C/C++(1696)

      VSC proposes to add them to the IncludePath... shall I do it ? or is it something I can solve in the config files ?

      Regards
      louis.h

        and yes I guess these issues with the header files are causing this error at linking stage

        /Users/louis/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: modules/nrf/drivers/gps/nrf9160_gps/lib..__nrf__drivers__gps__nrf9160_gps.a(nrf9160_gps.c.obj): in function `enable_gps':
        /Users/louis/ncs/nrf/drivers/gps/nrf9160_gps/nrf9160_gps.c:361: undefined reference to `lte_lc_system_mode_get'
        /Users/louis/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/louis/ncs/nrf/drivers/gps/nrf9160_gps/nrf9160_gps.c:389: undefined reference to `lte_lc_func_mode_get'
        /Users/louis/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/louis/ncs/nrf/drivers/gps/nrf9160_gps/nrf9160_gps.c:380: undefined reference to `lte_lc_system_mode_set'
        collect2: error: ld returned 1 exit status
        %
        ninja: build stopped: subcommand failed.
        FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /Users/louis/ncs/nrf/samples/nrf9160/gps/build

          lbh00 try removing the build dir:

          rm -rf build

          And try again.

            This is the command I always do
            especially when I have a compilation issue to remove the caches effects

            rm -rf build && rm -rf ~/Library/Caches/zephyr && west build -b circuitdojo_feather_nrf9160ns -p

              lbh00 Can you provide the output of git log -n 1 and git status? (in the gps example directory is fine)

                yes:

                git log -n 1 
                commit c2d3f852399c96009677077c166e722ae0a54e5a (HEAD, tag: v1.3.2, origin/v1.3-branch)
                Author: Carles Cufi <carles.cufi@nordicsemi.no>
                Date:   Fri Oct 9 11:32:06 2020 +0200
                
                    manifest: Set sdk-zephyr to v2.3.0-rc1-ncs3
                    
                    For the NCS 1.3.2 release, point sdk-zephyr to the corresponding tag.
                    
                    Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
                louis@Louiss-MBP gps % git status
                HEAD detached at v1.3.2
                Changes not staged for commit:
                  (use "git add <file>..." to update what will be committed)
                  (use "git restore <file>..." to discard changes in working directory)
                        modified:   ../at_client/prj.conf
                        modified:   CMakeLists.txt
                        modified:   prj.conf
                
                Untracked files:
                  (use "git add <file>..." to include in what will be committed)
                        ../../../.DS_Store
                        ../../.DS_Store
                        ../.DS_Store
                
                no changes added to commit (use "git add" and/or "git commit -a")

                  lbh00

                  git checkout CMakeLists.txt

                  (You may have to provide the full path.)

                  See here for details.

                    did this git checkout HEAD CMakeLists.txt

                    but I still have the same linking issue!

                      Hello,

                      I have just set this config to n
                      CONFIG_NRF9160_GPS_HANDLE_MODEM_CONFIGURATION=n
                      and the linking was successful.
                      I guess this tells it to use the GPS driver ?

                        so problem solved and case closed.

                        GPS testing started!

                        Terms and Conditions | Privacy Policy