mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Allow variants to define an initVariant() function that is called at startup.
See #2080
This commit is contained in:
parent
11e02db954
commit
40270306e0
@ -192,14 +192,23 @@ public class Compiler implements MessageConsumer {
|
||||
sketch.setCompilingProgress(50);
|
||||
includePaths.clear();
|
||||
includePaths.add(corePath); // include path for core only
|
||||
if (variantPath != null) includePaths.add(variantPath);
|
||||
List<File> coreObjectFiles =
|
||||
compileFiles(avrBasePath, buildPath, includePaths,
|
||||
findFilesInPath(corePath, "S", true),
|
||||
findFilesInPath(corePath, "c", true),
|
||||
findFilesInPath(corePath, "cpp", true),
|
||||
if (variantPath != null)
|
||||
includePaths.add(variantPath);
|
||||
List<File> coreObjectFiles = compileFiles( //
|
||||
avrBasePath, buildPath, includePaths, //
|
||||
findFilesInPath(corePath, "S", true), //
|
||||
findFilesInPath(corePath, "c", true), //
|
||||
findFilesInPath(corePath, "cpp", true), //
|
||||
boardPreferences);
|
||||
|
||||
if (variantPath != null)
|
||||
objectFiles.addAll(compileFiles( //
|
||||
avrBasePath, buildPath, includePaths, //
|
||||
findFilesInPath(variantPath, "S", true), //
|
||||
findFilesInPath(variantPath, "c", true), //
|
||||
findFilesInPath(variantPath, "cpp", true), //
|
||||
boardPreferences));
|
||||
|
||||
String runtimeLibraryName = buildPath + File.separator + "core.a";
|
||||
List baseCommandAR = new ArrayList(Arrays.asList(new String[] {
|
||||
avrBasePath + "avr-ar",
|
||||
|
@ -19,10 +19,17 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// Weak empty variant initialization function.
|
||||
// May be redefined by variant files.
|
||||
void initVariant() __attribute__((weak));
|
||||
void initVariant() { }
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
initVariant();
|
||||
|
||||
#if defined(USBCON)
|
||||
USBDevice.attach();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user