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

Thread: Compile Error Issue While Adding a New Board Type

  1. #1
    Junior Member
    Join Date
    Jul 2020
    Posts
    6

    Compile Error Issue While Adding a New Board Type

    Hello all.
    I am building a multi-purpose USB device project with my Teensy 3.6 board.
    I want to make a teensy board that works for a multi-purpose USB including MTP + HID + KeyBoard + ...
    So I had to add a new board type, I first simply added an "xyz" board to C:\Program Files (x86)\Arduino\hardware\teensy\avr\boards.txt.
    The boards.txt look like:

    Code:
    ...
    teensy36.menu.usb.mtp=MTP Disk (Experimental)
    teensy36.menu.usb.mtp.build.usbtype=USB_MTPDISK
    teensy36.menu.usb.mtp.fake_serial=teensy_gateway
    teensy36.menu.usb.xyz=xyz
    teensy36.menu.usb.xyz.build.usbtype=xyz
    teensy36.menu.usb.xyz.fake_serial=xyz
    teensy36.menu.usb.rawhid=Raw HID
    teensy36.menu.usb.rawhid.build.usbtype=USB_RAWHID
    teensy36.menu.usb.rawhid.fake_serial=teensy_gateway
    ...
    And I rebooted my Arduino IDE, I successfully found the new board type in the "USB Type" tab.

    Click image for larger version. 

Name:	abc.jpg 
Views:	15 
Size:	77.0 KB 
ID:	21097

    However, when I try to compile a following empty source code:

    Code:
    void setup() {
    }
    void loop() {
    }
    I encountered an error message "Error resolving FQBN: getting".
    Is there anybody who has encountered this error message before?
    I just added a new board type and simply selected that a new board type in my Arduino IDE.
    The error messages look like:

    Code:
    Arduino:1.8.13 (Windows 10), TD: 1.53, Board:"Teensy 3.6, xyz, 180 MHz, Faster, US English"
    
    C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\dongbin\Documents\Arduino\libraries -fqbn=teensy:avr:teensy36:usb=xyz,speed=180,opt=o2std,keys=en-us -ide-version=10813 -build-path C:\Users\dongbin\AppData\Local\Temp\arduino_build_33752 -warnings=all -build-cache C:\Users\dongbin\AppData\Local\Temp\arduino_cache_956757 -verbose C:\Program Files (x86)\Arduino\examples\Teensy\USB_RawHID\Basic\Basic.pde
    
    Error resolving FQBN: getting
    
    Error Compiling for Board Teensy 3.6.
    I was searching many other threads about adding a new board type.
    However, I couldn't find any case showing a similar error message to mine after adding a new board type.
    Do you have any ideas what the problem is?
    I also added an "xyz" board to the "boards.txt" file for other versions (Teensy 2.0, Teensy 3.1, etc.) besides Teensy 3.6.

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    394
    FQBN might be "fully qualified board name"? Or maybe not. You have named something that isn't defined I think.

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,642
    My first guess of what I might try is change your one line: teensy36.menu.usb.xyz.fake_serial=xyz
    to either not have it or it may have to be teensy_gateway

    And see if that goes farther. Needless to say it won't go far without other stuff.
    as for example the files usb_desc.h looks for the USB Types and defines a bunch of other stuff, like it has sections:
    Code:
    #if defined(USB_SERIAL)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x0483
      #define DEVICE_CLASS		2	// 2 = Communication Class
      #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
      #define MANUFACTURER_NAME_LEN	11
      #define PRODUCT_NAME		{'U','S','B',' ','S','e','r','i','a','l'}
      #define PRODUCT_NAME_LEN	10
      #define EP0_SIZE		64
      #define NUM_ENDPOINTS		4
      #define NUM_USB_BUFFERS	12
      #define NUM_INTERFACE		2
      #define CDC_STATUS_INTERFACE	0
      #define CDC_DATA_INTERFACE	1
      #define CDC_ACM_ENDPOINT	2
      #define CDC_RX_ENDPOINT       3
      #define CDC_TX_ENDPOINT       4
      #define CDC_ACM_SIZE          16
      #define CDC_RX_SIZE           64
      #define CDC_TX_SIZE           64
      #define ENDPOINT2_CONFIG	ENDPOINT_TRANSMIT_ONLY
      #define ENDPOINT3_CONFIG	ENDPOINT_RECEIVE_ONLY
      #define ENDPOINT4_CONFIG	ENDPOINT_TRANSMIT_ONLY
    
    #elif defined(USB_DUAL_SERIAL)
    ...
    And needless to say XYZ is not in the list.

  4. #4
    Junior Member
    Join Date
    Jul 2020
    Posts
    6
    Quote Originally Posted by KurtE View Post
    My first guess of what I might try is change your one line: teensy36.menu.usb.xyz.fake_serial=xyz
    Thank you for advising!

    I solved this problem when I run my Arduino IDE by administrator mode in my Windows 10.
    And I also had to run source code editor by administrator mode for modifying core codes such as usb_desc.h, usb_dev.c.

    Thanks,
    Dongbin Na
    Last edited by dongbinna; 09-01-2020 at 03:35 AM. Reason: I missed the quote.

  5. #5
    Junior Member
    Join Date
    Jul 2020
    Posts
    6
    Quote Originally Posted by MarkT View Post
    FQBN might be "fully qualified board name"? Or maybe not. You have named something that isn't defined I think.
    Thank you for replying!
    I think the FQBN denotes "Fully Qualified Board Name" as you mentioned.

    I solved this problem when I run my Arduino IDE by administrator mode in my Windows 10.
    And I also had to run source code editor by administrator mode for modifying core codes such as usb_desc.h, usb_dev.c.

    Thanks,
    Dongbin Na

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,380
    Saw FQBN in editing to create the TSET command line builder - never bothered to understand what it stood for.

    But I can say in the batch file it must have these elements matching everything in the boards.txt:
    Code:
    set fqbn=teensy:avr:%model%:usb=%usb%,speed=%speed%,opt=%opt%,keys=%keys%
    Those are the elements set in the IDE tools menu
    Code:
    The board name > avr:%model%:
    USB Type - this will need to be added to match "xyz" > usb=%usb%,
    one of the speed options > speed=%speed%,
    build compile options > opt=%opt%,
    keyboard language > keys=%keys%
    Like this for Teensy 4.0 build with US keyboard:
    Code:
    set model=teensy40
    set speed=600
    set opt=o2std
    set usb=serial
    set keys=en-us
    Edit : sorry I missed this a month ago ...

  7. #7
    Junior Member
    Join Date
    Jul 2020
    Posts
    6
    Quote Originally Posted by defragster View Post
    Saw FQBN in editing to create the TSET command line builder
    I really appreciate your replying.

    But, where did you find the following code?
    Code:
    set fqbn=teensy:avr:%model%:usb=%usb%,speed=%speed%,opt=%opt%,keys=%keys%
    I didn't find any word similar to "fqbn" when I saw all the Arduino compiler messages.
    Arduino IDE just runs the C:\Program Files (x86)\Arduino\arduino-builder for compiling and then compiles all the teensy core header and .c files, and my source code in Arduino IDE.
    Last edited by dongbinna; 09-01-2020 at 04:06 AM. Reason: I missed the quote.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,380
    That was cut from the TSET batch file that passes this info in. Without that unless the CMDLINE is diseccted the info is only held in the IDE, so I used that to explain the named elements needed.

    Look in boards.txt :: here it is >> T:\arduino-1.8.13\hardware\teensy\avr\boards.txt at the top is :
    Code:
    menu.usb=USB Type
    menu.speed=CPU Speed
    menu.opt=Optimize
    menu.keys=Keyboard Layout

    In that file for Teensy 3.6 find the section starting :
    Code:
    teensy36.name=Teensy 3.6
    teensy36.upload.maximum_size=1048576
    teensy36.upload.maximum_data_size=262144
    teensy36.upload.tool=teensyloader
    teensy36.upload.protocol=halfkay
    teensy36.build.board=TEENSY36
    ...
    There the elements that relate as noted in the above post:
    Code:
    teensy36.build.board
    teensy36.menu.usb.
    teensy36.menu.speed
    teensy36.menu.opt.o2std
    teensy36.menu.keys
    So in a batch file for T_3.6 the settings would be as follows where 'model' maps into '.board':
    Code:
    set model=teensy36
    set speed=180
    set opt=o2std
    set usb=serial
    set keys=en-us
    So what is needed for the creation of the new USB type is to create a boards.txt section that matches what is added on your system, it will show then when the IDE is restarted with an added option for 'xyz' AFAIK.

    So duplicate ::
    Code:
    teensy36.menu.usb.serial=Serial
    teensy36.menu.usb.serial.build.usbtype=USB_SERIAL
    as ::
    Code:
    teensy36.menu.usb.xyz=MYxyz
    teensy36.menu.usb.serial.build.usbtype=USB_XYZ
    Then it seems:
    "MYxyz" would show in the IDE as the build option under USB type
    "USB_XYZ" would be defined during the build

    <edit> in the source files where >> #if defined(USB_SERIAL)
    appears your code would trigger on :: #if defined(USB_XYZ)
    Last edited by defragster; 09-01-2020 at 05:10 AM.

  9. #9
    Junior Member
    Join Date
    Jul 2020
    Posts
    6
    Quote Originally Posted by defragster View Post
    That was cut from the TSET batch file that passes this info in.
    Thank you for your detailed explanation.
    Now I have defined my own board type and compiled it without any error.

  10. #10
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,380
    Great to know it got you to working!

Posting Permissions

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