<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Missing &quot;__libc_init_array();&quot; wenn using samd without USB]]></title><description><![CDATA[<p dir="auto">Hello all,</p>
<p dir="auto">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.</p>
<pre><code>/*
 * 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 &lt;henrik.ekblad@mysensors.org&gt;
 * 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;
}
</code></pre>
<p dir="auto">I don't know why it is within the condition and if it is good to move it outside, but it seems to work.</p>
]]></description><link>https://forum.mysensors.org/topic/11988/missing-__libc_init_array-wenn-using-samd-without-usb</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 09:20:10 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/11988.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Jul 2022 08:36:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Missing &quot;__libc_init_array();&quot; wenn using samd without USB on Thu, 07 Jul 2022 22:47:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ltigges" aria-label="Profile: ltigges">@<bdi>ltigges</bdi></a><br />
Hi, I can confirm your issue. Thank you for reporting!<br />
Best will be to open a new issue in in the GitHub repo at <a href="https://github.com/mysensors/MySensors/issues" rel="nofollow ugc">MySensors/issues</a>.<br />
It would be great if you could do that- thank you.<br />
BR Immo</p>
]]></description><link>https://forum.mysensors.org/post/112537</link><guid isPermaLink="true">https://forum.mysensors.org/post/112537</guid><dc:creator><![CDATA[virtualmkr]]></dc:creator><pubDate>Thu, 07 Jul 2022 22:47:17 GMT</pubDate></item></channel></rss>