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

Thread: Run mbed-os on Teensy 4.0?

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Posts
    10

    Run mbed-os on Teensy 4.0?

    I was wondering whether there's any relatively easy way to run mbed-os on the new Teensy 4.0. As far as I can tell the MCU itself should be supported after all.

    I've been playing around with custom targets without any luck so far. If someone has already done this I'd be very happy to get some guidance.

    Thanks

  2. #2
    Junior Member
    Join Date
    Oct 2019
    Posts
    10
    Replying to myself.. so, I'm able to compile and flash a HEX file. I've no idea whether what I'm uploading to the teensy is actually executable, though. Next step would be to upload a simple blinky example. For that I probably have to figure out the correct PinNames.h for this board.

    So far I've got a custom target targeting the Cortex-M7FD core (I'm assuming the FD stands for floating point double precision?)

    Anyway, this is my custom_targets.json. I suppose a lot of the stuff defined in here is still wrong, but one step at a time...

    Code:
    {
        "TEENSY4_0": {
            "inherits": ["Target"],
            "core": "Cortex-M7FD",
            "supported_toolchains": ["ARM", "GCC_ARM"],
            "extra_labels": ["NXP", "MCUXpresso_MCUS", "EVK", "MIMXRT1050", "IMX", "NXP_EMAC"],
            "is_disk_virtual": true,
            "macros": [
                "CPU_MIMXRT1052DVL6B",
                "FSL_RTOS_MBED",
                "XIP_BOOT_HEADER_ENABLE=1",
                "XIP_EXTERNAL_FLASH=1",
                "XIP_BOOT_HEADER_DCD_ENABLE=1",
                "SKIP_SYSCLK_INIT",
                "FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE",
                "MBED_MPU_CUSTOM",
                "MBED_TICKLESS"
            ],
            "post_binary_hook": {
                "function": "TEENSY3_1Code.binary_hook",
                "toolchains": ["ARM_STD", "ARM_MICRO", "GCC_ARM"]
            },
            "detect_code": ["0270"],
            "device_has": [
                "RTC",
                "SLEEP",
                "USTICKER",
                "LPTICKER",
                "ANALOGIN",
                "EMAC",
                "I2C",
                "I2CSLAVE",
                "ERROR_RED",
                "INTERRUPTIN",
                "PORTIN",
                "PORTINOUT",
                "PORTOUT",
                "PWMOUT",
                "SERIAL",
                "SPI",
                "SPISLAVE",
                "STDIO_MESSAGES",
                "TRNG"
            ],
            "OUTPUT_EXT": "hex",
            "release_versions": ["2", "5"],
            "device_name": "MIMXRT1062xxxxA"
        }
    }
    If I make any further progress I'll be documenting it in here. And if anyone wants to point out some obvious errors, please go ahead, as I don't really know what I'm doing.

  3. #3
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,616
    I don't know if building for 1050 will work with T4 which is a 1060. I did pre-beta evaluation using mbed and NXP 1050 eval board. mbed compiler didn't support NXP 1060 eval board, so I had to use NXP's MCUXpresso IDE for testing 1060.

  4. #4
    Junior Member
    Join Date
    Oct 2019
    Posts
    10
    Oh, you're right! It's supposed to target the 1060, I didn't catch that. I'll be looking into this, thanks for pointing this out!

  5. #5
    Junior Member
    Join Date
    Feb 2020
    Posts
    4
    Keen to hear how you got on with this? Iím keen to have access to a better HAL than Arduino for my project.

  6. #6
    Quote Originally Posted by jimsy View Post
    Keen to hear how you got on with this? Iím keen to have access to a better HAL than Arduino for my project.
    I am following up on this thread to see if any progress has been made on getting mbed to work on a Teensy 4.x.
    The 4.0 and 4.1 really beg for an RTOS (with good HAL support, especially I2C and SPI).

  7. #7
    Junior Member
    Join Date
    Oct 2019
    Posts
    10
    I've not been working on this anymore and I'm relying solely on Teensyduino for the time being.

  8. #8
    Junior Member
    Join Date
    Feb 2020
    Posts
    4
    Something that you may be interested in trying, if you're using Teensyduino is HeliOS - https://github.com/MannyPeterson/HeliOS - it gives you some RTOS features without getting in the way. I have successfully used FreeRTOS, but I find the APIs less than ergonomic. Alas, this is as far as I've gotten.

  9. #9
    Quote Originally Posted by jimsy View Post
    Something that you may be interested in trying, if you're using Teensyduino is HeliOS - https://github.com/MannyPeterson/HeliOS - it gives you some RTOS features without getting in the way. I have successfully used FreeRTOS, but I find the APIs less than ergonomic. Alas, this is as far as I've gotten.

    Thanks, that looks interesting.
    I've played with FreeRTOS on the Teensy. It's a bit painful as all the Arduino library calls have to have synchronization calls around them. That's the thing that cool about mbed, i2C, SPI, Ethernet, etc, are all reentrant and efficient (don't block use of CPU during transmissions).
    Helios is still blocking (Arduino library calls), though you don't have to worry about synchronization so much.

  10. #10
    Quote Originally Posted by rhyde View Post
    I am following up on this thread to see if any progress has been made on getting mbed to work on a Teensy 4.x.
    The 4.0 and 4.1 really beg for an RTOS (with good HAL support, especially I2C and SPI).
    Totally agree with this rhyde - if it was available - I'd be using it already. Hmmm....

    Regards,
    John W.

Posting Permissions

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