matthijskooijman / arduino-lmic

:warning: This library is deprecated, see the README for alternatives.
707 stars 650 forks source link

Atmel 32u4 fails to compile #95

Open rmoscetti opened 7 years ago

rmoscetti commented 7 years ago

Dear all, I am trying to compile the lmic library on the Adafruit Feather 32u4 RFM95 LoRa Radio - 868 or 915 MHz. I've got a problem compiling the void section in the sketch in which this API is included.

LMIC_setTxData2(1, lmic_packet, strlen((char *)lmic_packet), 0);

I am taking some part from this sketch (https://github.com/mikenz/Feather_M0_LoRa/blob/master/Feather_M0_LoRa.ino), but i am using a feather board with a 32u4 cortex instead of the m0 cortex.

#define STARTUP_MESSAGE "Hello World!"

#if defined(STARTUP_MESSAGE)
void sendStartupMessage() {
    // Ensure there is not a current TX/RX job running
    if (LMIC.opmode & (1 << 7)) {
        // Something already in the queque
        return;
    }

    // Put together the data to send
    char packet[41] = STARTUP_MESSAGE;

    // Debug message
    Serial.print("  seqno ");
    Serial.print(LMIC.seqnoUp);
    Serial.print(": ");
    Serial.println(packet);

    // Add to the queque
    dataSent = false;
    uint8_t lmic_packet[41];
    strcpy((char *)lmic_packet, packet);
    LMIC_setTxData2(1, lmic_packet, strlen((char *)lmic_packet), 0);

    // Wait for the data to send or timeout after 15s
    elapsedMillis sinceSend = 0;
    while (!dataSent && sinceSend < 15000) {
        os_runloop_once();
        delay(1);
    }
    os_runloop_once();
}
#endif

I obtained the following errors: ..\AppData\Local\Temp\ccAIVSm3.ltrans0.ltrans.o: In function reportEvent.lto_priv.70': ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:929: undefined reference toonEvent' ..\AppData\Local\Temp\ccAIVSm3.ltrans0.ltrans.o: In function aes_encrypt': ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:175: undefined reference toos_getDevKey' ..\AppData\Local\Temp\ccAIVSm3.ltrans0.ltrans.o: In function aes_verifyMic0': ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:169: undefined reference toos_getDevKey' ..\AppData\Local\Temp\ccAIVSm3.ltrans0.ltrans.o: In function aes_sessKeys': ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:201: undefined reference toos_getDevKey' ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:203: undefined reference to os_getDevKey' ..\AppData\Local\Temp\ccAIVSm3.ltrans2.ltrans.o: In functionbuildJoinRequest': ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:1809: undefined reference to os_getArtEui' ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:1810: undefined reference toos_getDevEui' ..\AppData\Local\Temp\ccAIVSm3.ltrans2.ltrans.o: In function aes_appendMic0': ..\Documents\Arduino\libraries\arduino-lmic-master\src\lmic/lmic.c:163: undefined reference toos_getDevKey' collect2.exe: error: ld returned 1 exit status

Thank you in advance.

Best Regards

PhatHub commented 7 years ago

I know this is a bit late, but I figured I'd try to toss some help back into the community... You might want to include more information about your setup. Are you running ABP? OTAA? I'm guessing OTAA since you're missing a reference to your DevKey retrieval function...? Apparently the ArtEui callback is nonexistant too?

Apparently your callback functions are missing. So copy lines 804-835 from the FeatherM0Lora file, and make sure that the constants that they call on are populated.