Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Bug Reports
  3. Missing "__libc_init_array();" wenn using samd without USB

Missing "__libc_init_array();" wenn using samd without USB

Scheduled Pinned Locked Moved Bug Reports
2 Posts 2 Posters 20 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    ltigges
    wrote on last edited by
    #1

    Hello all,

    I tried to build atsam gateway without USB support and had the problem that the sercom pointer were not initialized. The problem is that without the "USBCON" define, “__libc_init_array()” is not called within the MyMainSAMD.cpp main(). After moving “__libc_init_array()” out of the “USBCON” condition, everything works fine.

    /*
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2020 Sensnology AB
     * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     */
    
    // Initialize library and handle sketch functions like we want to
    
    extern "C" void __libc_init_array(void);
    
    int main(void)
    {
    	init();   
            __libc_init_array();      // after
    #if defined(USBCON)	
    //        __libc_init_array();     before
    	USBDevice.init();
    	USBDevice.attach();
    #endif
    	_begin(); // Startup MySensors library
    	for(;;) {
    		_process();  // Process incoming data
    		if (loop) {
    			loop(); // Call sketch loop
    		}
    		if (serialEventRun) {
    			serialEventRun();
    		}
    	}
    	return 0;
    }
    

    I don't know why it is within the condition and if it is good to move it outside, but it seems to work.

    V 1 Reply Last reply
    0
    • L ltigges

      Hello all,

      I tried to build atsam gateway without USB support and had the problem that the sercom pointer were not initialized. The problem is that without the "USBCON" define, “__libc_init_array()” is not called within the MyMainSAMD.cpp main(). After moving “__libc_init_array()” out of the “USBCON” condition, everything works fine.

      /*
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2020 Sensnology AB
       * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       */
      
      // Initialize library and handle sketch functions like we want to
      
      extern "C" void __libc_init_array(void);
      
      int main(void)
      {
      	init();   
              __libc_init_array();      // after
      #if defined(USBCON)	
      //        __libc_init_array();     before
      	USBDevice.init();
      	USBDevice.attach();
      #endif
      	_begin(); // Startup MySensors library
      	for(;;) {
      		_process();  // Process incoming data
      		if (loop) {
      			loop(); // Call sketch loop
      		}
      		if (serialEventRun) {
      			serialEventRun();
      		}
      	}
      	return 0;
      }
      

      I don't know why it is within the condition and if it is good to move it outside, but it seems to work.

      V Offline
      V Offline
      virtualmkr
      wrote on last edited by virtualmkr
      #2

      @ltigges
      Hi, I can confirm your issue. Thank you for reporting!
      Best will be to open a new issue in in the GitHub repo at MySensors/issues.
      It would be great if you could do that- thank you.
      BR Immo

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      11

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular