Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking issue on a mac for Blinky project #12

Open
adigandhi opened this issue Sep 27, 2017 · 1 comment
Open

Linking issue on a mac for Blinky project #12

adigandhi opened this issue Sep 27, 2017 · 1 comment

Comments

@adigandhi
Copy link

I get the error below when compiling the sketch on macos High Sierra, with Arduino 1.8.4 and teensyduino on top.

My Sketch

/*
 * Example to demonstrate thread definition, semaphores, and thread sleep.
 */


// The LED is attached to pin 13 on Arduino.
const uint8_t LED_PIN = 13;

// Declare a semaphore handle.
SemaphoreHandle_t sem;
//------------------------------------------------------------------------------
/*
 * Thread 1, turn the LED off when signalled by thread 2.
 */
// Declare the thread function for thread 1.
static void Thread1(void* arg) {
  while (1) {

    // Wait for signal from thread 2.
    xSemaphoreTake(sem, portMAX_DELAY);

    // Turn LED off.
    digitalWrite(LED_PIN, LOW);
  }
}
//------------------------------------------------------------------------------
/*
 * Thread 2, turn the LED on and signal thread 1 to turn the LED off.
 */
// Declare the thread function for thread 2.
static void Thread2(void* arg) {

  pinMode(LED_PIN, OUTPUT);

  while (1) {
    // Turn LED on.
    digitalWrite(LED_PIN, HIGH);

    // Sleep for 200 milliseconds.
    vTaskDelay((200L * configTICK_RATE_HZ) / 1000L);

    // Signal thread 1 to turn LED off.
    xSemaphoreGive(sem);

    // Sleep for 200 milliseconds.
    vTaskDelay((200L * configTICK_RATE_HZ) / 1000L);
  }
}
//------------------------------------------------------------------------------
void setup() {
  portBASE_TYPE s1, s2;

  Serial.begin(9600);
  
  // initialize semaphore
  sem = xSemaphoreCreateCounting(1, 0);

  // create task at priority two
  s1 = xTaskCreate(Thread1, NULL, configMINIMAL_STACK_SIZE, NULL, 2, NULL);

  // create task at priority one
  s2 = xTaskCreate(Thread2, NULL, configMINIMAL_STACK_SIZE, NULL, 1, NULL);

  // check for creation errors
  if (sem== NULL || s1 != pdPASS || s2 != pdPASS ) {
    Serial.println(F("Creation problem"));
    while(1);
  }
  // start scheduler
  vTaskStartScheduler();
  Serial.println(F("Insufficient RAM"));
  while(1);
}
//------------------------------------------------------------------------------
// WARNING idle loop has a very small stack (configMINIMAL_STACK_SIZE)
// loop must never block
void loop() {
  // Not used.
}

Error log

Linking everything together...
"/Applications/Arduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-gcc" -O2 -Wl,--gc-sections,--relax,--defsym=__rtc_localtime=1506482470 "-T/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/mk20dx256.ld" -lstdc++  -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -o "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/freertos.ino.elf" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/sketch/freertos.ino.cpp.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/FreeRTOS_ARM.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/assertMsg.cpp.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/basic_io_arm.cpp.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/croutine.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/event_groups.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/heap_3.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/list.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/port.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/queue.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/tasks.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/timers.c.o" "/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/core/core.a" "-L/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264" -larm_cortexM4l_math -lm
/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/core/core.a(EventResponder.cpp.o): In function `pendablesrvreq_isr':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/EventResponder.cpp:86: multiple definition of `pendablesrvreq_isr'
/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/port.c.o:/Users/xxxxxxxxx/Documents/Arduino/libraries/FreeRTOS_ARM/src/utility/port.c:469: first defined here
/Applications/Arduino.app/Contents/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: Disabling relaxation: it will not work with multiple definitions
/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/core/core.a(EventResponder.cpp.o): In function `EventResponder::triggerEventNotImmediate()':
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/EventResponder.cpp:45: multiple definition of `systick_isr'
/var/folders/0p/861x6w911d32vmxzcgxm8wpm0000gn/T/arduino_build_335264/libraries/FreeRTOS_ARM/utility/port.c.o:/Users/xxxxxxxxx/Documents/Arduino/libraries/FreeRTOS_ARM/src/utility/port.c:291: first defined here
collect2: error: ld returned 1 exit status
Using library FreeRTOS_ARM at version 2015.11.12 in folder: /Users/xxxxxxxxx/Documents/Arduino/libraries/FreeRTOS_ARM 
@greiman
Copy link
Owner

greiman commented Sep 27, 2017

Looks like the new Teensy EventResponder is causing the problem. I have decided it is not worth supporting FreeRTOS on Arduino.

See this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants