Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Building BlinkLED

  1. #1

    Building BlinkLED

    I have my Teensy 3.2 working with the default program. In order to get used to it I decided to take the sample Blink using digitalWriteFast and compile it from the command line. If I take the main.cpp file and enter it into Ardunio it compiles and download. However when I run it from the command line and down load it it does not work. I'm using cygwin on Windows 7 Pro (yeah, I have several Linux VMs but I can only connect the Teensy to may physical Windows box right now). And I'd rather not use Ardunio. I've done a lot of searching trying to figure out what's happening.

    * The main.hex file from my compile is only 4KB while the Ardunio is much larger at 39 KB so I'm missing parts! The main.elf file from my compile is 35847KB so I'm guessing something with the
    * The compile and build goes without errors

    I have all my files in a directory structured as
    Project Home
    -- src - contains main.cpp
    -- tools - The Teensy tools (compilers, teensy_reboot, etc.)
    -- teensy3 - a copy of the Ardunio Teensy3 directory installed by Teensyduino
    -- libraries - empty right now
    -- Build - the build process happens here.

    Where are the functions like digitalWriteFast stored. Are they in the teensy3 directory in the c and cpp files that are there or are they somewhere else? So far I can't find them. I assume that if I wanted to control something like an LCD I'd need to load the library for the LCD. The tutorials look good for doing the simple stuff but the all seem to be sketch oriented.

    I've attached the Makefile as Makefile.txt and it's taken from apmorton's teensy template.

    Any input would be appreciated. I'm looking forward to getting my touchscreen and graphic screen going - after I do the tutorials!

    Thanks.
    Attached Files Attached Files
    Last edited by GeraltMCU; 05-20-2016 at 08:01 AM. Reason: Clarify item

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,565
    If you think the ELF file looks valid it seems that TYQT can upload an ELF file.

  3. #3
    Quote Originally Posted by defragster View Post
    If you think the ELF file looks valid it seems that TYQT can upload an ELF file.
    I'll give that at try. The only reason I think the elf file might be valid is because it's 35KB close to the size of the hex file Ardunio produces. Trying that will at least tell me if it's good.

    If the elf is good something went wrong in the hex file creation then.

    I'll try this later today after I get some sleep - it;s 0300 here <G>).

    Any ideas what might have gone wrong with the hex file generation>

    I found the digitalwritefast in one of the header files.

    I can see this Teensy is going to be fun to use once I get used to it. I've got some projects for it!

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,565
    Teensy is fun and powerful - and properly named too!

    Did you notice that dwFast() requires a constant for the pin#.

    I'm still using the IDE - easy enough and reliable and everything on the forum runs around it. It isn't like the IDE pollutes the program with ads or bloat - it uses the same tools and the PJRC system is built around using it too full advantage out of the box. Rebuilds are 5-15 seconds usually for what I'm playing with - on a old slower laptop, I could cut to less than half easily by just going downstairs to my desktop.

  5. #5
    Quote Originally Posted by defragster View Post
    Teensy is fun and powerful - and properly named too!

    Did you notice that dwFast() requires a constant for the pin#.

    I'm still using the IDE - easy enough and reliable and everything on the forum runs around it. It isn't like the IDE pollutes the program with ads or bloat - it uses the same tools and the PJRC system is built around using it too full advantage out of the box. Rebuilds are 5-15 seconds usually for what I'm playing with - on a old slower laptop, I could cut to less than half easily by just going downstairs to my desktop.
    Yes, in fact I used the main.cpp I got from one of Paul's repositories. It's a simple program that defines the pin numbers, then loops turning the LED on and off.

    I'm not worried about IDE bloat. I have an IDE and editors I use routinely for work and will be using them to make Teensy. For me the IDE environment I'm familiar with makes me more productive as I have the editing, build, and testing tool all in one. I just - and this is just my opinion and preference - don't like the Ardunio interface plus I prefer to work with Teensy by itself. If I ever do an Arduino chip I'll use my IDE for it ,too.

    I've gotten the build process to successfully run and generate a hex file in my IDE. However, the hex file did not upload or work so I went to the command line to do some debugging and see what's going on. It appears the elf file is okay (I'll check that later today) so if it is that means the step of creating the hex file broke. I'll create a script to export the variables I need and then run each hex build command one at a time from the command line so I can see what's happening and hopefully get it fixed.

    Teensy has lots of potential and I am really looking forward to using it. Right now I'm going through the learning curve!

  6. #6
    Finally figured it out. Boy was I brain dead. I messed up and the teensy3 files were never being pulled in so of course main.hex had nothing in it. It's been a good journey into the internals of make files and make.

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,565
    Good work - it isn't easy to figure without a working trail. Did you get anything useful to share? Some others using Visual Micro on Visual Studio - but that just gives a new IDE that is aware of the Arduino tree. That will probably be what I go to - but VS is up to 2015 and I have remnants of 4 disused installs of VS already so need to do house keeping.

  8. #8
    Basically it's the Makefile contents. I'm used to building in a separate directory but that means the Makefile rules and actions take some tweaking. I've not done anything with make at this level (just used the generated ones) so I've been learning about make <G>! At tihs point I know what went wrong but I'm still working on getting the make rules set up so they work correctly with a separate build directory. Once I get it figured out I'll post some information on how to make it work. Once I have make running from the command line it's easy to use Qtcreator and I'll set that up and do a how to.

    MS sure leaves pieces all over. I have a pro/enterprise version of 2010 that I got through MSDN but I've been using Qt for any work for a while. I never updated to 2012 because I didn't need it and that was the version that they released as alpha with no color coding for keywords, etc. because some moron at MS decided to ignore decades of research about how to make people work more effectively (must have been the same moron who came up with the office toolbar). Since I didn't need it I never kept up with it. Along the way I found Qt when we had to use it in a C++ class (nice thing about working for a university - you get free classes) and I liked it. I do work on Linux too so I have a common IDE.

  9. #9
    I I have a makefile system working that builds in a separate directory. I need to tweak it, try a couple of things, and clean up the code and then I'll post the files and documentation on GitLab. It's my first work with make as the files were usually provided and make is very powerful but can be obscure and wierd. Entering make reminds me of "You are in a maze of twisty, turny passages." greeting from an old game. It may be late next week as a client called up out of the blue and wants to upgrade an audio system installed 13 years ago that has just been running. The programming workstation is a 13 year old Compaq that's still running!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •