9 Replies Latest reply on May 20, 2019 10:26 AM by vpr_motomods

    Trouble compiling nuttx

    lllars

      I'm working through the hello world example, and trying to get setup to compile the firmware, following the directions here: https://developer.motorola.com/build/tools/build-from-source

       

      I'm stuck at the "make" step, under "compile nuttx".  I get this error:

       

      Traceback (most recent call last):

        File "/home/lars/programming/moto_mod/bootrom-tools/create-tftf", line 35, in <module>

          from tftf import Tftf, TFTF_SECTION_TYPE_RAW_CODE, \

        File "/home/lars/programming/moto_mod/bootrom-tools/tftf.py", line 34, in <module>

          from string import rfind

      ImportError: cannot import name 'rfind'

      dd: failed to open 'nuttx.tftf': No such file or directory

      make: *** [Makefile.unix:451: pass2] Error 1

       

      If I just comment out line 34, and retry I get:

       

      Traceback (most recent call last):

        File "/home/lars/programming/moto_mod/bootrom-tools/create-tftf", line 390, in <module>

          main()

        File "/home/lars/programming/moto_mod/bootrom-tools/create-tftf", line 332, in main

          tftf_header = Tftf(args.header_size)

        File "/home/lars/programming/moto_mod/bootrom-tools/tftf.py", line 407, in __init__

          self.reserved = [0] * TFTF_HDR_NUM_RESERVED

      TypeError: can't multiply sequence by non-int of type 'float'

      dd: failed to open 'nuttx.tftf': No such file or directory

      make: *** [Makefile.unix:451: pass2] Error 1

       

      I scoured the web, but can't find any answers.  I'm using arch linux, not ubuntu, so maybe that's part of the problem.  Anyone have any clues or ideas for me to try?

        • Re: Trouble compiling nuttx
          aarongfranco

          make sure you have defined BUILD_TOP variables.

           

          > echo $BUILD_TOP
          ... should output .. /path/to/your/nuttx/installation

           

          Without it you will continue to get the "nuttx.tftf" No such file or directory error.

            • Re: Trouble compiling nuttx
              lllars

              Yes, I have BUILD_TOP defined correctly:

               

              lars ~/programming/moto_mod (1) $ echo $BUILD_TOP

              /home/lars/programming/moto_mod

               

              I don't seem to have nuttx.tftf anywhere, I was assuming it gets created during the build process that is failing for me.  This returns no results:

               

              lars ~/programming/moto_mod (1) $ find ./| grep nuttx.tftf

                • Re: Trouble compiling nuttx
                  garengllc

                  Can you try building one of their pre-supplied projects without any changes (like usb2)?

                   

                  $ export PATH=$PATH:$BUILD_TOP/manifesto:$BUILD_TOP/bootrom-tools
                  $ cd $BUILD_TOP/nuttx/nuttx
                  $ make distclean
                  $ cd $BUILD_TOP/nuttx/nuttx/tools
                  $ ./configure.sh hdk/muc/usb2

                  $ cd $BUILD_TOP/nuttx/nuttx
                  $ make

                   

                  Then you should have the .tftf file in the nuttx/nuttx directory.

                    • Re: Trouble compiling nuttx
                      lllars

                      Ok, just tried that.  I get the same error:

                       

                      MuC

                      Traceback (most recent call last):

                        File "/home/lars/programming/moto_mod/bootrom-tools/create-tftf", line 35, in <module>

                          from tftf import Tftf, TFTF_SECTION_TYPE_RAW_CODE, \

                        File "/home/lars/programming/moto_mod/bootrom-tools/tftf.py", line 34, in <module>

                          from string import rfind

                      ImportError: cannot import name 'rfind'

                      dd: failed to open 'nuttx.tftf': No such file or directory

                      make: *** [Makefile.unix:451: pass2] Error 1

                        • Re: Trouble compiling nuttx
                          garengllc

                          Did you make sure to install all the build dependencies begore you got started?

                          $ sudo apt-get install -y git gperf flex bison libncurses5-dev gcc-arm-none-eabi python-pip
                          $ sudo pip install pyelftools

                           

                          Also, if you type "python --version" are you get a Python 2.7.x or a 3.5.x?

                            • Re: Trouble compiling nuttx
                              lllars

                              $ python --version

                              Python 3.6.0

                               

                              $ python2 --version

                              Python 2.7.13

                               

                              I think I have all dependencies.  Like I said, I'm running arch, so my package names and versions are a bit different.

                               

                              $ sudo pacman -S git gperf flex bison ncurses arm-none-eabi-gcc python-pip

                              warning: git-2.12.0-1 is up to date -- reinstalling

                              warning: gperf-3.1-1 is up to date -- reinstalling

                              warning: flex-2.6.3-1 is up to date -- reinstalling

                              warning: bison-3.0.4-2 is up to date -- reinstalling

                              warning: ncurses-6.0+20170128-1 is up to date -- reinstalling

                              warning: arm-none-eabi-gcc-6.3.0-1 is up to date -- reinstalling

                              warning: python-pip-9.0.1-2 is up to date -- reinstalling

                              resolving dependencies...

                               

                              $ sudo pip install pyelftools

                              Requirement already satisfied: pyelftools in /usr/lib/python3.6/site-packages

                               

                              Any way to check if this is python 2 vs 3 version problem?

                                • Re: Trouble compiling nuttx
                                  garengllc

                                  Hmm, I am not sure which version of python is really needed, but when I type python --version on my working system, I get Python 2.7.6.  So it is possible that that is an issue.  Anyway you can alias python to python2 and see if that helps any?

                                    • Re: Trouble compiling nuttx
                                      lllars

                                      Ok, we're getting somewhere.  I got it to compile.  It was indeed a python 2 vs 3 problem.

                                       

                                      Aliasing didn't work.  I had also originally tried changing the first line of tftf.py to #! /usr/bin/env python2, but that made no difference either, which led me to think it wasn't a python2/3 issue.

                                       

                                      What worked was to trick the environment as suggested in the Arch wiki page for python.  The trick involves crating symlinks in ~/bin for python and python-config to the 2.x versions.

                                       

                                      Thanks for the help guys.  It worked for usb2, I haven't actually tried it for the original hello world example yet, but I assume that will work now.

                                      1 of 1 people found this helpful