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

Thread: blink_fast.hex file for Teensy 3.5

  1. #1
    Junior Member
    Join Date
    Oct 2016
    Posts
    12

    blink_fast.hex file for Teensy 3.5

    Downloaded the blink_hex zip file in order to start testing. I have a Teensy 3.5.

    However, there are multiple hex files in the unzipped folder. Appreciate someone telling which is the correct hex file to use.

    Also, which C compilers (or IDE's) can be used to generate hex files for the Teensy 3.5 ?

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,920
    Arduino. It uses gcc.
    You need Teensyduino, too, in this case. It extends Arduino.

  3. #3
    Junior Member
    Join Date
    Oct 2016
    Posts
    12
    Anything else besides Arduino ? I am developing code using gcc. So, can I just use plain gcc to create hex files ?

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,717
    Quote Originally Posted by digysol View Post
    Anything else besides Arduino ? I am developing code using gcc. So, can I just use plain gcc to create hex files ?
    Arduino + Teensyduino from Paul is all you need.
    All is cpp, but you can put plain c into separate .c files

    Assume you have a standalone test program with main and not setup/loop:
    a way to port such standard main to Arduino concept:
    either divide your cpp program into setup function and into functions that are called repetitively via the loop().

    of if to difficult
    simple workaround

    open from Arduino new program
    you will get an empty sketch labelled say "sketch_oct28a" for today
    save the sketch, this creates a directory sketch_oct28a or the name you choose,in your local Arduino folder
    copy your *.cpp program (say myApp.cpp) into this folder.

    open this file with Arduino (opens a new window with the basic *ino file and the new myApp.cpp file in the tabs)
    select your myApp.cpp file and change main to, say 'myApp'
    select the ino file and insert in setup a call to myApp

    Your ino program is now something like this


    Code:
    int myApp(void);
    
    void setup() {
      // put your setup code here, to run once:
    
      myApp();
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    and you separate program is something like this

    Code:
    #include "arduino.h"
    
    void blink (uint32_t del) { digitalWriteFast(13,!digitalReadFast(13)); delay(del);}
    
    int myApp(void)
    {
    	pinMode(13,OUTPUT);
    	
    	while(1)
    	{
    		for(int ii=1; ii<10; ii++)
    			blink(10*ii);
    	}
    	return 0;
    }
    verify or download, that is all.

    Yes, I know, there a lot of steps to do, and I only mention it because it is an option.
    If non-Arduino program will run on teensy, that is another question.

    IMO, the best thing is to start simple, analyse your program, divide it into setup functions and into recurring operations that may go into loop().

    If you do not like Arduino environment, you can always use a makefile setup, and there are some other IDE's promoted in this forum.
    There is a makefile in Teensy3/core in the Arduino folder.
    Last edited by WMXZ; 10-28-2016 at 02:24 PM. Reason: Matlab mixup, additionoal typos

  5. #5
    Junior Member
    Join Date
    Oct 2016
    Posts
    12
    Thanks for the extensive replay. i will try the setup / loop breakdown.

    There may be issues related to typing and overall size of the code. But, let me give it a shot.

    What's the largest Arduino-generated executable (hex) file that you are aware of ?

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,920
    Size of the code ?? Tell more about your project! I'm curious.
    My largest code for Teensy was about 170KB.

  7. #7
    Junior Member
    Join Date
    Oct 2016
    Posts
    12
    Unfortunately, I can't say more about the project. But, the fact that your largest size code went to 170 KB makes me feel better.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,194
    The HEX file is ascii text and typically much larger than the actual code size - where FrankB says code about 170KB the hex was possibly ~250KB. But the T_3.5 has room for over 500KB of code/data that has probably been tested somewhat - the T_3.6 can take 1MB in code and flash data and that was tested over the 512KB boundary.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,476
    Quote Originally Posted by digysol View Post
    Anything else besides Arduino ? I am developing code using gcc. So, can I just use plain gcc to create hex files ?
    You can, but using Arduino is so much simpler. All Arduino does is run gcc. In File > Preferences, turn on verbose info while compiling to see the actual gcc commands it executes when you compile.

    Leaving the comfort of Arduino is possible, but if you're not familiar with the details, I strongly recommend you at least use Arduino to avoid fiddling with so many tech details and get your project off to a good start.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,476
    I've updated the stand-alone Teensy Loader pages with the latest software (supports 3.5 & 3.6) and blink slow & fast hex files for the new boards.

Posting Permissions

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