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

Set preprocessor defines for various boards in default.yaml #7

Closed
ianfixes opened this issue Jan 25, 2018 · 1 comment
Closed

Set preprocessor defines for various boards in default.yaml #7

ianfixes opened this issue Jan 25, 2018 · 1 comment
Labels
arduino mocks Compilation mocks for the Arduino library YAML The configuration files or system

Comments

@ianfixes
Copy link
Collaborator

This looks like a good resource for what #defines might be available

https://arduino.stackexchange.com/questions/21137/arduino-how-to-get-the-board-type-in-code

#if defined(TEENSYDUINO) 

    //  --------------- Teensy -----------------

    #if defined(__AVR_ATmega32U4__)
        #define BOARD "Teensy 2.0"
    #elif defined(__AVR_AT90USB1286__)       
        #define BOARD "Teensy++ 2.0"
    #elif defined(__MK20DX128__)       
        #define BOARD "Teensy 3.0"
    #elif defined(__MK20DX256__)       
        #define BOARD "Teensy 3.2" // and Teensy 3.1 (obsolete)
    #elif defined(__MKL26Z64__)       
        #define BOARD "Teensy LC"
    #elif defined(__MK64FX512__)
        #define BOARD "Teensy 3.5"
    #elif defined(__MK66FX1M0__)
        #define BOARD "Teensy 3.6"
    #else
       #error "Unknown board"
    #endif

#else // --------------- Arduino ------------------

    #if   defined(ARDUINO_AVR_ADK)       
        #define BOARD "Mega Adk"
    #elif defined(ARDUINO_AVR_BT)    // Bluetooth
        #define BOARD "Bt"
    #elif defined(ARDUINO_AVR_DUEMILANOVE)       
        #define BOARD "Duemilanove"
    #elif defined(ARDUINO_AVR_ESPLORA)       
        #define BOARD "Esplora"
    #elif defined(ARDUINO_AVR_ETHERNET)       
        #define BOARD "Ethernet"
    #elif defined(ARDUINO_AVR_FIO)       
        #define BOARD "Fio"
    #elif defined(ARDUINO_AVR_GEMMA)
        #define BOARD "Gemma"
    #elif defined(ARDUINO_AVR_LEONARDO)       
        #define BOARD "Leonardo"
    #elif defined(ARDUINO_AVR_LILYPAD)
        #define BOARD "Lilypad"
    #elif defined(ARDUINO_AVR_LILYPAD_USB)
        #define BOARD "Lilypad Usb"
    #elif defined(ARDUINO_AVR_MEGA)       
        #define BOARD "Mega"
    #elif defined(ARDUINO_AVR_MEGA2560)       
        #define BOARD "Mega 2560"
    #elif defined(ARDUINO_AVR_MICRO)       
        #define BOARD "Micro"
    #elif defined(ARDUINO_AVR_MINI)       
        #define BOARD "Mini"
    #elif defined(ARDUINO_AVR_NANO)       
        #define BOARD "Nano"
    #elif defined(ARDUINO_AVR_NG)       
        #define BOARD "NG"
    #elif defined(ARDUINO_AVR_PRO)       
        #define BOARD "Pro"
    #elif defined(ARDUINO_AVR_ROBOT_CONTROL)       
        #define BOARD "Robot Ctrl"
    #elif defined(ARDUINO_AVR_ROBOT_MOTOR)       
        #define BOARD "Robot Motor"
    #elif defined(ARDUINO_AVR_UNO)       
        #define BOARD "Uno"
    #elif defined(ARDUINO_AVR_YUN)       
        #define BOARD "Yun"

    // These boards must be installed separately:
    #elif defined(ARDUINO_SAM_DUE)       
        #define BOARD "Due"
    #elif defined(ARDUINO_SAMD_ZERO)       
        #define BOARD "Zero"
    #elif defined(ARDUINO_ARC32_TOOLS)       
        #define BOARD "101"
    #else
       #error "Unknown board"
    #endif

#endif
@ianfixes ianfixes added arduino mocks Compilation mocks for the Arduino library YAML The configuration files or system labels Jan 25, 2018
@ianfixes
Copy link
Collaborator Author

Merging with #89

jgfoster pushed a commit that referenced this issue Oct 4, 2021
…efore the fix to Client.h we get the following error:

```
# Subtest: Client_copy_constructor
    ok 1 - assertEqual "1" == *(c1.mGodmodeDataIn)
    ok 2 - assertEqual "2" == *(c2.mGodmodeDataIn)
    not ok 3 - assertNotEqual c1.mGodmodeDataIn != c2.mGodmodeDataIn
      ---
      operator: !=
      unwanted: 0x603000007750
      actual: 0x603000007750
      at:
        file: /Users/jfoster/Documents/Arduino/libraries/TestSomething/test/clientServer.cpp
        line: 32
      ...
    ok 4 - assertEqual "1" == *(c1.mGodmodeDataIn)
    ok 5 - assertEqual "1" == *(c2.mGodmodeDataIn)
    not ok 6 - assertEqual "11" == *(c1.mGodmodeDataIn)
      ---
      operator: ==
      expected: 11
      actual: 112
      at:
        file: /Users/jfoster/Documents/Arduino/libraries/TestSomething/test/clientServer.cpp
        line: 37
      ...
    not ok 7 - assertEqual "12" == *(c2.mGodmodeDataIn)
      ---
      operator: ==
      expected: 12
      actual: 112
      at:
        file: /Users/jfoster/Documents/Arduino/libraries/TestSomething/test/clientServer.cpp
        line: 38
      ...
AddressSanitizer:DEADLYSIGNAL
=================================================================
==16588==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0001076e5918 bp 0x7ffee8564290 sp 0x7ffee8564260 T0)
==16588==The signal is caused by a READ memory access.
==16588==Hint: this fault was caused by a dereference of a high value address (see register values below).  Dissassemble the provided pc to learn which register was used.
    #0 0x1076e5918 in __asan::Allocator::Deallocate(void*, unsigned long, unsigned long, __sanitizer::BufferedStackTrace*, __asan::AllocType)+0x48 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x5918)
    #1 0x107733125 in wrap__ZdlPv+0xe5 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x53125)
    #2 0x10769d528 in String::~String() WString.h:65
    #3 0x10769d228 in String::~String() WString.h:65
    #4 0x1076a6856 in Client::~Client() Client.h:35
    #5 0x1076a2f48 in Client::~Client() Client.h:33
    #6 0x1076a3473 in test_Client_copy_constructor::task() clientServer.cpp:39
    #7 0x1076a8390 in Test::test() ArduinoUnitTests.h:205
    #8 0x1076a7f2d in Test::run(Test::ReporterTAP*) ArduinoUnitTests.h:176
    #9 0x1076a5713 in Test::run_and_report(int, char**) ArduinoUnitTests.h:195
    #10 0x1076a5658 in main clientServer.cpp:110
    #11 0x7fff70a26cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)

==16588==Register values:
rax = 0x0000000000000002  rbx = 0xbebebebebebebebe  rcx = 0x0000000000000003  rdx = 0x0000000000000000
rdi = 0xbebebebebebebebe  rsi = 0xbebebebebebebebe  rbp = 0x00007ffee8564290  rsp = 0x00007ffee8564260
 r8 = 0x00007ffee85642a0   r9 = 0x0000000000000002  r10 = 0xffffffffffffffff  r11 = 0x00000fffffffffff
r12 = 0x0000000000000002  r13 = 0x0000000000000000  r14 = 0x00007ffee85642a0  r15 = 0x0000000107780d40
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x5918) in __asan::Allocator::Deallocate(void*, unsigned long, unsigned long, __sanitizer::BufferedStackTrace*, __asan::AllocType)+0x48
==16588==ABORTING
...Unit testing clientServer.cpp with g++ for uno                              ✗
```

After the fix we get the following:

```
# Subtest: Client_copy_constructor
    ok 1 - assertEqual "1" == *(c1.mGodmodeDataIn)
    ok 2 - assertEqual "2" == *(c2.mGodmodeDataIn)
    ok 3 - assertNotEqual c1.mGodmodeDataIn != c2.mGodmodeDataIn
    ok 4 - assertEqual "1" == *(c1.mGodmodeDataIn)
    ok 5 - assertEqual "1" == *(c2.mGodmodeDataIn)
    ok 6 - assertEqual "11" == *(c1.mGodmodeDataIn)
    ok 7 - assertEqual "12" == *(c2.mGodmodeDataIn)
    ok 8 - True true
    1..8
ok 2 - Client_copy_constructor
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arduino mocks Compilation mocks for the Arduino library YAML The configuration files or system
Projects
None yet
Development

No branches or pull requests

1 participant