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

Thread: How to change code flashing address in Arduino IDE for Teensy 3.6

  1. #1

    How to change code flashing address in Arduino IDE for Teensy 3.6

    I am using the teensy 3.6 board.
    I want to flash my firmware through boot-loader codes so I flashed example boot-loader code using MCUExpresso IDE, and want to flash my firmware at address 0x0000C000, but my firmware is written in Arduino IDE and I want to change the flashing address to 0x0000C000. How can I change the flashing address in Arduino IDE for my firmware?
    I am using Kinetis Flash tool for flashing my firmware through boot loader code but I am getting error "kStatusMemoryRangeInvalid", but if I tried to load sample led firmware build by MCUExpresso it's flashing without any problem.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,567
    ? So where are the interrupt vectors, then?
    Not sure if I understood your question correctly.. you don't use the Teensy-loader app?
    Do you use the MKL Boooader chip? Is this a 3rd-party product?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,942
    Are you really using a Teensy 3.6 board?

    Everything you're asking is pretty much the wrong way to go about using Teensy 3.6.

  4. #4
    I am using freedom bootloader example code to flash my firmware through Kinetis flash tool. So freedom boot loader is the main code which communicates with kinetis flash tool to load user application in teensy 3.6 board, so I can load sample led code which is built by MCUExpress IDE but when I tried to load sample code which is built by Arduino IDE then I got an error in kinetis flash tool "kStatusMemoryRangeInvalid". I am trying to flash sample code at location 0xC000.

  5. #5
    I am trying to bypass MKL02Z32VFG4 bootloader chip.
    I want to write my boot loader code in teensy' main MCU so i can load my firmware through my boot loader code via UART protocol.

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,386
    That seems not to be the way the Teensy 3.6 is intended to work. All Teensys come with an external bootloader chip on board which handles the upload process through USB so that no program space is wasted for bootloader code. Programming through UART is not supported.

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,567
    You'd have to change many more things, too.. the core thinks the teensy is fresh from reset or power-on, so initialization of many things will go wrong. The program-button will start the original bootloader, a long press or just accidentally using the Teensy Loader will delete yours. You'll have 48KB Flashmemory less.
    You'd have to edit the corresponding linkerscript.
    Last edited by Frank B; 04-09-2019 at 06:56 AM.

  8. #8
    I am flashing example boot loader code using teensy's loader and after that, I am using kinetis flash tool which communicates with that example bootloader code and I can successfully load sample led code.

    So bypassing is not a problem, the problem is I can only flash code which is built by MCUExpresso IDE and I want to flash code which is built in Arduino IDE, kinetis flash tool required .hex file to load code teensy, so I think there are some changes required in Arduino IDE built because I am getting error of memory (kStatusMemoryRangeInvalid).

    MCUExpresso's example code also require changes in linker file for target flashing address, after that, I can successfully flash the code through boot loader code, so like that, I need to change some setting in Arduino ide so can solve the error getting by kinetis flash tool.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Untitled.png 
Views:	16 
Size:	28.2 KB 
ID:	16366  

  9. #9
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,567
    You need to edit the linkerscript.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,942
    What is the ultimate purpose of all this?

    Because it sure sounds like your goal is to convert everything that's been developed for Teensy to some non-Teensy hardware, and ask for our help in doing so!

  11. #11
    I am trying to implement OTA upgradation in Teensy via XBee module, for that, I have to write bootloader in Main MCU.

  12. #12
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,386
    Quote Originally Posted by bhavitrajput View Post
    I am trying to implement OTA upgradation in Teensy via XBee module, for that, I have to write bootloader in Main MCU.
    That is a contradiction with the current principle of operation inside the Teensy and Teensyduino ecosystem. People buy a Teensy instead of a bare K66 CPU to get all that Teensyduino stuff, library support, and Arduino compatibility for free. The price is that we accept as a counterpart that flashing a Teensy is exclusively done through a MKL02/04 boot loader IC which is preprogrammed with some magic sauce from PJRC. That's PJRC's business model. Schematics are free, software (source code) is free, support is free, but you go through their boot loader.

    Don't expect any support for whatever will work around this principle.

  13. #13
    So can you suggest me any alternative for OTA upgradation without bypassing bootloader IC?

  14. #14
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,386
    Unfortunately, you do not tell us everything about your project, so it is difficult to give a pertinent advice.

    The first question is, why is OTA needed in your project? As an old school developer, I aim towards releasing software/firmware which is well thought, elaborated, and tested in advance, so that frequent firmware updates should not be required. But perhaps you do not want to transfer firmware but application data (music, graphics, etc.) towards the Teensy without changing the firmware. In that case, solutions like external SPI flash memory, probably dual ported (read by the Teensy and written by a Wifi-enabled MCU).

    But without knowing more details about what you want to achieve...

  15. #15
    I have developed my firmware which is written in Arduino IDE and working at the remote location so now whenever I want to do any changes I have to go there, so that's why I want OTA upgradation for teensy.

Posting Permissions

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