├── samples ├── cc3200-sample │ ├── ccs │ │ ├── macros.ini │ │ ├── .ccsimportspec │ │ ├── .ccsproject │ │ └── cc3200v1p32.cmd │ ├── macros.ini_initial │ ├── targetConfigs │ │ └── CC3200.ccxml │ ├── pinmux.h │ ├── pinmux.c │ ├── cc3200v1p32.cmd │ └── common.h ├── nrf52-ble-template-sdk12.3 │ ├── README.md │ ├── ble_app_template.eww │ ├── pca10028 │ │ └── s130 │ │ │ ├── armgcc │ │ │ ├── ble_app_template_gcc_nrf51.ld │ │ │ └── Makefile │ │ │ ├── iar │ │ │ └── ble_app_template_iar_nRF5x.icf │ │ │ ├── arm4 │ │ │ └── ble_app_template_pca10028_s130.uvopt │ │ │ └── arm5_no_packs │ │ │ └── ble_app_template_pca10028_s130.uvoptx │ ├── pca10040 │ │ └── s132 │ │ │ ├── armgcc │ │ │ └── ble_app_template_gcc_nrf52.ld │ │ │ ├── iar │ │ │ └── ble_app_template_iar_nRF5x.icf │ │ │ ├── arm4 │ │ │ └── ble_app_template_pca10040_s132.uvopt │ │ │ └── arm5_no_packs │ │ │ └── ble_app_template_pca10040_s132.uvoptx │ └── pca10056 │ │ └── s132 │ │ ├── armgcc │ │ ├── ble_app_template_gcc_nrf52.ld │ │ └── Makefile │ │ ├── iar │ │ └── ble_app_template_iar_nRF5x.icf │ │ ├── arm4 │ │ └── ble_app_template_pca10056_s132.uvopt │ │ └── arm5_no_packs │ │ └── ble_app_template_pca10056_s132.uvoptx ├── nrf52-ble-template-sdk13 │ ├── README.md │ ├── logging_config.h │ ├── events_config.json │ └── ble_app_template_gcc_nrf52.ld └── nrf52-ble-sample-project │ ├── CMakeLists.txt │ ├── logging_config.h │ ├── events_config.json │ ├── ble_app_template_gcc_nrf52.ld │ └── README.md ├── .gitmodules ├── NOTICE ├── external └── CMakeLists.txt ├── ulogger ├── CMakeLists.txt ├── compilers.h ├── ulogger_events.h ├── ulogger.c ├── network_log_handler.h ├── ubuffer.h ├── network_log_handler.c ├── ubuffer.c └── ulogger.h ├── test └── test_module │ ├── logging_config.h │ ├── mock_critical_section.h │ ├── mock_critical_section.c │ ├── mock_user_handlers.h │ ├── CMakeLists.txt │ ├── test_ulogger.c │ ├── mock_user_handlers.c │ ├── tests_runner.c │ └── test_ubuffer.c ├── CMakeLists.txt ├── platforms ├── nrf52 │ ├── CMakeLists.txt │ ├── trace_nrf52.h │ ├── ulogger_nrf52.h │ ├── logging_config.h │ ├── trace_nrf52.c │ ├── gatt_handler.h │ ├── ulogger_nrf52.c │ ├── README.md │ └── gatt_handler.c └── cc3200 │ ├── ulogger_cc3200.h │ ├── json_formatter.h │ ├── logging_config.h │ ├── json_encoding_helper.h │ ├── events_api_handler.h │ ├── json_formatter.c │ ├── events_api_handler.c │ ├── ulogger_cc3200.c │ └── README.md ├── .gitignore ├── doxygen-bootstrapped ├── footer.html ├── header.html ├── customdoxygen.css ├── doxy-boot.js └── LICENSE ├── porting.md ├── README.md ├── tools └── package_generator.sh └── LICENSE /samples/cc3200-sample/ccs/macros.ini: -------------------------------------------------------------------------------- 1 | CC3200_SDK_ROOT= -------------------------------------------------------------------------------- /samples/cc3200-sample/macros.ini_initial: -------------------------------------------------------------------------------- 1 | CC3200_SDK_ROOT= -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/Unity"] 2 | path = external/Unity 3 | url = https://github.com/ThrowTheSwitch/Unity.git 4 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Jumper Logging Agent 2 | Copyright 2017 Jumper Labs LTD. 3 | 4 | This product includes software developed at Jumper Labs LTD. 5 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/README.md: -------------------------------------------------------------------------------- 1 | Note: This template project is meant to work with the nRF52 SDK v12, for using with SDK v13 go to "nrf52-ble-template-sdk13" -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk13/README.md: -------------------------------------------------------------------------------- 1 | Note: This template project is meant to work with the nRF52 SDK v13, for using with SDK v12 go to "nrf52-ble-template-sdk12.3" -------------------------------------------------------------------------------- /samples/cc3200-sample/ccs/.ccsimportspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(Unity STATIC 2 | Unity/src/unity.c Unity/extras/fixture/src/unity_fixture.c 3 | ) 4 | 5 | target_include_directories(Unity PUBLIC 6 | Unity/src PUBLIC Unity/extras/fixture/src 7 | ) -------------------------------------------------------------------------------- /ulogger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCE_FILES 2 | ubuffer.c 3 | ubuffer.h 4 | ulogger.c 5 | ulogger.h 6 | ulogger_events.h 7 | network_log_handler.c 8 | network_log_handler.h 9 | compilers.h) 10 | 11 | add_library(ulogger ${SOURCE_FILES}) 12 | -------------------------------------------------------------------------------- /samples/nrf52-ble-sample-project/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # THIS FILE IS ON:Y USED FOR IDE INTEGRATION AND NOT FOR BUILDING THE PROJECT 2 | # Use make instead 3 | 4 | include_directories(../../ulogger) 5 | link_directories(../../ulogger) 6 | add_executable(nrf-sample-project config/sdk_config.h logging_config.h main.c) 7 | target_link_libraries(nrf-sample-project ulogger nrf52) 8 | -------------------------------------------------------------------------------- /test/test_module/logging_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_LOGGING_CONFIG_H 2 | #define JUMPER_ULOGGER_LOGGING_CONFIG_H 3 | 4 | #include "mock_critical_section.h" 5 | 6 | #define ULOGGER_ENTER_CRITICAL_SECTION() mock_enter_critical_section() 7 | #define ULOGGER_EXIT_CRITICAL_SECTION() mock_exit_critical_section() 8 | 9 | #endif //JUMPER_ULOGGER_LOGGING_CONFIG_H 10 | -------------------------------------------------------------------------------- /test/test_module/mock_critical_section.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_MOCK_CRITICAL_SECTION_H 2 | #define JUMPER_ULOGGER_MOCK_CRITICAL_SECTION_H 3 | 4 | void mock_enter_critical_section(); 5 | 6 | void mock_exit_critical_section(); 7 | 8 | int mock_critical_section_state(); 9 | 10 | int mock_critical_section_calls(); 11 | 12 | #endif //JUMPER_ULOGGER_MOCK_CRITICAL_SECTION_H 13 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | project(jumper_ulogger) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | set(CMAKE_VERBOSE_MAKEFILE ON) 6 | 7 | 8 | include(CTest) 9 | enable_testing() 10 | 11 | add_subdirectory(external) 12 | add_subdirectory(ulogger) 13 | add_subdirectory(test/test_module) 14 | add_subdirectory(platforms/nrf52) 15 | add_subdirectory(samples/nrf52-ble-sample-project) 16 | -------------------------------------------------------------------------------- /samples/nrf52-ble-sample-project/logging_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 2 | #define JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 3 | 4 | #define PLATFORM_CC3200 1 5 | #define PLATFORM_NRF52 2 6 | 7 | #define ULOGGER_PLATFORM PLATFORM_NRF52 8 | 9 | #define GATT_BUFFER_SIZE 200 10 | #define LOG_SEND_PERIOD_MS 5000 11 | 12 | #endif //JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 13 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk13/logging_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 2 | #define JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 3 | 4 | #define PLATFORM_CC3200 1 5 | #define PLATFORM_NRF52 2 6 | 7 | #define ULOGGER_PLATFORM PLATFORM_NRF52 8 | 9 | #define GATT_BUFFER_SIZE 200 10 | #define LOG_SEND_PERIOD_MS 5000 11 | 12 | #endif //JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 13 | -------------------------------------------------------------------------------- /platforms/nrf52/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # THIS FILE IS ON:Y USED FOR IDE INTEGRATION AND NOT FOR BUILDING THE PROJECT 2 | # Use make instead 3 | 4 | include_directories($ENV{NRF52_SDK} ../../ulogger) 5 | link_directories($ENV{NRF52_SDK} ../../ulogger) 6 | 7 | set(SRC_FILES gatt_handler.c gatt_handler.h logging_config.h trace_nrf52.c trace_nrf52.h ulogger_nrf52.c ulogger_nrf52.c) 8 | 9 | add_library(nrf52 STATIC ${SRC_FILES}) 10 | target_link_libraries(nrf52 ulogger NRF_SDK) -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/ble_app_template.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $WS_DIR$\pca10028\s130\iar\ble_app_template_pca10028_s130.ewp 5 | 6 | $WS_DIR$\pca10056\s132\iar\ble_app_template_pca10056_s132.ewp 7 | 8 | $WS_DIR$\pca10040\s132\iar\ble_app_template_pca10040_s132.ewp 9 | 10 | -------------------------------------------------------------------------------- /platforms/nrf52/trace_nrf52.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_TRACE_NRF52_H_H 2 | #define JUMPER_ULOGGER_TRACE_NRF52_H_H 3 | 4 | #include "logging_config.h" 5 | 6 | #if ULOGGER_PLATFORM == PLATFORM_NRF52 7 | 8 | #include "ble_advertising.h" 9 | #include "ble.h" 10 | 11 | #define NRF_BLE_LOGGER ulogger 12 | 13 | void ulogger_trace_nrf_ble_event(ble_evt_t *p_ble_evt); 14 | void ulogger_trace_nrf_ble_adv_event(ble_adv_evt_t ble_adv_evt); 15 | 16 | #endif 17 | 18 | #endif //JUMPER_ULOGGER_TRACE_NRF52_H_H 19 | -------------------------------------------------------------------------------- /samples/cc3200-sample/ccs/.ccsproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/test_module/mock_critical_section.c: -------------------------------------------------------------------------------- 1 | #include "mock_critical_section.h" 2 | 3 | static int is_critical_section; 4 | static int critical_section_calls = 0; 5 | 6 | 7 | void mock_enter_critical_section() { 8 | is_critical_section = 1; 9 | critical_section_calls++; 10 | } 11 | 12 | void mock_exit_critical_section() { 13 | is_critical_section = 0; 14 | } 15 | 16 | int mock_critical_section_calls() { 17 | return critical_section_calls; 18 | } 19 | 20 | int mock_critical_section_state() { 21 | return is_critical_section; 22 | } -------------------------------------------------------------------------------- /platforms/nrf52/ulogger_nrf52.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @defgroup nrf52_platform nRF52 Platform 4 | * @{ 5 | */ 6 | 7 | #ifndef ULOGGER_NRF52 8 | #define ULOGGER_NRF52 9 | 10 | #include "ulogger.h" 11 | #include "trace_nrf52.h" 12 | #include "ble.h" 13 | 14 | uLogger ulogger; 15 | 16 | /** 17 | * @brief Initializes the supplied uLogger structure 18 | * @param ulogger A uLogger handle 19 | */ 20 | void ulogger_init_nrf52(uLogger* logger); 21 | 22 | void ulogger_handle_ble_event(ble_evt_t * p_ble_evt); 23 | 24 | #endif 25 | /** 26 | * @} 27 | */ 28 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk13/events_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": { 3 | "type": "DEVICE_STARTED", 4 | "data": {} 5 | }, 6 | "1": { 7 | "type":"RADIO_STATE", 8 | "data": { 9 | "is_on": "B" 10 | } 11 | }, 12 | "2": { 13 | "type":"ADVERTISING_STATE", 14 | "data": { 15 | "is_on": "B" 16 | } 17 | }, 18 | "3": { 19 | "type": "BATTERY_LEVEL", 20 | "data": { 21 | "level": "B" 22 | } 23 | }, 24 | "4": { 25 | "type": "BLE_STATE", 26 | "data": { 27 | "is_connected": "B" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /platforms/cc3200/ulogger_cc3200.h: -------------------------------------------------------------------------------- 1 | /**@file 2 | * @brief CC3200 Platform initialization. 3 | * 4 | * @defgroup cc3200_platform CC3200 Platform 5 | * @{ 6 | */ 7 | #ifndef ULOGGER_CC3200 8 | #define ULOGGER_CC3200 9 | 10 | #include "logging_config.h" 11 | 12 | #if ULOGGER_PLATFORM == PLATFORM_CC3200 13 | #include "ulogger.h" 14 | 15 | /** 16 | * @brief Initialization method for the cc3200 platform. 17 | * @param logger A uLogger instance 18 | */ 19 | void ulogger_init_cc3200(uLogger * logger); 20 | 21 | #endif 22 | 23 | #endif //ULOGGER_CC3200 24 | /** 25 | * @} 26 | */ 27 | -------------------------------------------------------------------------------- /samples/nrf52-ble-sample-project/events_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": { 3 | "type": "DEVICE_BOOT", 4 | "strings": ["version"] 5 | }, 6 | "1": { 7 | "type":"RADIO_STATE", 8 | "data": { 9 | "is_on": "B" 10 | } 11 | }, 12 | "2": { 13 | "type":"ADVERTISING_STATE", 14 | "data": { 15 | "is_on": "B" 16 | } 17 | }, 18 | "3": { 19 | "type": "BATTERY_LEVEL", 20 | "data": { 21 | "level": "B" 22 | } 23 | }, 24 | "4": { 25 | "type": "BLE_STATE", 26 | "data": { 27 | "is_connected": "B" 28 | } 29 | }, 30 | "5": { 31 | "type": "CUSTOM_STRING", 32 | "strings": ["custom_string"] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/test_module/mock_user_handlers.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_MOCK_USER_HANDLERS_H 2 | #define JUMPER_ULOGGER_MOCK_USER_HANDLERS_H 3 | 4 | #include 5 | #include "ulogger.h" 6 | 7 | #define NUM_HANDLERS 1 8 | 9 | void init_user_handlers(); 10 | 11 | void get_timestamp(timestamp *data); 12 | 13 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length); 14 | 15 | void assert_counters(uint32_t expected_value); 16 | 17 | void* handler_data[NUM_HANDLERS]; 18 | 19 | char retrieved_string[4096]; 20 | 21 | handler_func log_handlers[NUM_HANDLERS]; 22 | 23 | #endif //JUMPER_ULOGGER_MOCK_USER_HANDLERS_H 24 | -------------------------------------------------------------------------------- /platforms/nrf52/logging_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 2 | #define JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 3 | 4 | #include "ulogger.h" 5 | #include "app_util_platform.h" 6 | 7 | #define ULOGGER_PLATFORM PLATFORM_NRF52 8 | 9 | #define GATT_BUFFER_SIZE 200 10 | #define LOG_SEND_PERIOD_MS 5000 11 | 12 | //Platform config 13 | 14 | #ifdef APP_TIMER_CONFIG_RTC_FREQUENCY 15 | #define TICKS(x) APP_TIMER_TICKS(x) 16 | #else 17 | #define TICKS(x) APP_TIMER_TICKS(x,0) 18 | #endif 19 | 20 | #define ULOGGER_ENTER_CRITICAL_SECTION() CRITICAL_REGION_ENTER() 21 | #define ULOGGER_EXIT_CRITICAL_SECTION() CRITICAL_REGION_EXIT() 22 | 23 | #endif //JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 24 | -------------------------------------------------------------------------------- /ulogger/compilers.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_COMPILERS_H_H 2 | #define JUMPER_ULOGGER_COMPILERS_H_H 3 | 4 | #if defined ( __CC_ARM ) 5 | #ifndef __PACKED 6 | #define __PACKED __packed 7 | #endif 8 | 9 | #elif defined ( __ICCARM__ ) 10 | #ifndef __PACKED 11 | #define __PACKED __packed 12 | #endif 13 | 14 | #elif defined ( __ICCARM__ ) 15 | #ifndef __PACKED 16 | #define __PACKED __packed 17 | #endif 18 | 19 | #elif defined ( __GNUC__ ) 20 | #ifndef __PACKED 21 | #define __PACKED __attribute__((packed)) 22 | #endif 23 | 24 | #elif defined(__TI_COMPILER_VERSION__) 25 | #ifndef __PACKED 26 | #define __PACKED __attribute__((packed)) 27 | #endif 28 | #endif 29 | 30 | #endif //JUMPER_ULOGGER_COMPILERS_H_H 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | # Debug files 32 | *.dSYM/ 33 | *.su 34 | .idea/ 35 | .project 36 | cmake-build-debug/ 37 | _build/ 38 | venv/ 39 | 40 | *.DS_Store 41 | 42 | docs/ 43 | samples/cc3200-sample/ccs/Release 44 | samples/cc3200-sample/ccs/.settings 45 | 46 | 47 | samples/cc3200-sample/gcc/exe 48 | samples/cc3200-sample/ewarm/Release 49 | samples/cc3200-sample/ewarm/settings -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10028/s130/armgcc/ble_app_template_gcc_nrf51.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000 9 | RAM (rwx) : ORIGIN = 0x20001fe8, LENGTH = 0x6018 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data : 15 | { 16 | PROVIDE(__start_fs_data = .); 17 | KEEP(*(.fs_data)) 18 | PROVIDE(__stop_fs_data = .); 19 | } > RAM 20 | .pwr_mgmt_data : 21 | { 22 | PROVIDE(__start_pwr_mgmt_data = .); 23 | KEEP(*(.pwr_mgmt_data)) 24 | PROVIDE(__stop_pwr_mgmt_data = .); 25 | } > RAM 26 | } INSERT AFTER .data; 27 | 28 | INCLUDE "nrf5x_common.ld" 29 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10040/s132/armgcc/ble_app_template_gcc_nrf52.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000 9 | RAM (rwx) : ORIGIN = 0x20002138, LENGTH = 0xdec8 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data : 15 | { 16 | PROVIDE(__start_fs_data = .); 17 | KEEP(*(.fs_data)) 18 | PROVIDE(__stop_fs_data = .); 19 | } > RAM 20 | .pwr_mgmt_data : 21 | { 22 | PROVIDE(__start_pwr_mgmt_data = .); 23 | KEEP(*(.pwr_mgmt_data)) 24 | PROVIDE(__stop_pwr_mgmt_data = .); 25 | } > RAM 26 | } INSERT AFTER .data; 27 | 28 | INCLUDE "nrf5x_common.ld" 29 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10056/s132/armgcc/ble_app_template_gcc_nrf52.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0xe1000 9 | RAM (rwx) : ORIGIN = 0x20002128, LENGTH = 0x3ded8 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data : 15 | { 16 | PROVIDE(__start_fs_data = .); 17 | KEEP(*(.fs_data)) 18 | PROVIDE(__stop_fs_data = .); 19 | } > RAM 20 | .pwr_mgmt_data : 21 | { 22 | PROVIDE(__start_pwr_mgmt_data = .); 23 | KEEP(*(.pwr_mgmt_data)) 24 | PROVIDE(__stop_pwr_mgmt_data = .); 25 | } > RAM 26 | } INSERT AFTER .data; 27 | 28 | INCLUDE "nrf5x_common.ld" 29 | -------------------------------------------------------------------------------- /test/test_module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(../../ulogger ./) 2 | link_directories(../../ulogger) 3 | 4 | #set(SRC_FILES test_logger.c tests_runner.c) 5 | 6 | add_executable(ulogger_tests tests_runner.c test_ulogger.c test_ubuffer.c mock_user_handlers.c mock_critical_section.c 7 | logging_config.h) 8 | 9 | target_include_directories(ulogger PUBLIC ./) 10 | 11 | target_link_libraries(ulogger_tests Unity ulogger) 12 | 13 | 14 | #add_test(tests all_tests) 15 | # 16 | #add_custom_command( 17 | # TARGET all_tests 18 | # COMMENT "Run tests" 19 | # POST_BUILD 20 | # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test 21 | # COMMAND ${CMAKE_CTEST_COMMAND} -C $ --output-on-failures 22 | #) -------------------------------------------------------------------------------- /samples/nrf52-ble-sample-project/ble_app_template_gcc_nrf52.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000 9 | RAM (rwx) : ORIGIN = 0x20001fd0, LENGTH = 0xe030 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data : 15 | { 16 | PROVIDE(__start_fs_data = .); 17 | KEEP(*(.fs_data)) 18 | PROVIDE(__stop_fs_data = .); 19 | } > RAM 20 | } INSERT AFTER .data; 21 | 22 | SECTIONS 23 | { 24 | .pwr_mgmt_data : 25 | { 26 | PROVIDE(__start_pwr_mgmt_data = .); 27 | KEEP(*(SORT(.pwr_mgmt_data*))) 28 | PROVIDE(__stop_pwr_mgmt_data = .); 29 | } > FLASH 30 | } INSERT AFTER .text 31 | 32 | INCLUDE "nrf5x_common.ld" 33 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk13/ble_app_template_gcc_nrf52.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000 9 | RAM (rwx) : ORIGIN = 0x20001fd0, LENGTH = 0xe030 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data : 15 | { 16 | PROVIDE(__start_fs_data = .); 17 | KEEP(*(.fs_data)) 18 | PROVIDE(__stop_fs_data = .); 19 | } > RAM 20 | } INSERT AFTER .data; 21 | 22 | SECTIONS 23 | { 24 | .pwr_mgmt_data : 25 | { 26 | PROVIDE(__start_pwr_mgmt_data = .); 27 | KEEP(*(SORT(.pwr_mgmt_data*))) 28 | PROVIDE(__stop_pwr_mgmt_data = .); 29 | } > FLASH 30 | } INSERT AFTER .text 31 | 32 | INCLUDE "nrf5x_common.ld" 33 | -------------------------------------------------------------------------------- /doxygen-bootstrapped/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /platforms/cc3200/json_formatter.h: -------------------------------------------------------------------------------- 1 | /**@file 2 | * @brief Json formatter. 3 | * A json formatter used to format events before sending them to the events api. 4 | * @ingroup cc3200_platform 5 | * @{ 6 | */ 7 | #ifndef JSON_FORMATTER_H 8 | #define JSON_FORMATTER_H 9 | 10 | #include 11 | #include 12 | 13 | #include "network_log_handler.h" 14 | 15 | typedef struct { 16 | uint8_t * buffer; 17 | size_t buffer_length; 18 | uint8_t mac_address[6]; 19 | } json_formatter_context; 20 | 21 | /** 22 | * @brief A formatter implementation as defined in network_log_handler.h, to format your custom events 23 | * you must implement a case in the formatter for each event. 24 | */ 25 | int json_formatter_format(void * formatter_context, uLoggerEventHeader * event, 26 | uint8_t ** formatted_event, size_t * formatted_event_length); 27 | 28 | #endif //JSON_FORMATTER_H 29 | /** 30 | * @} 31 | */ 32 | -------------------------------------------------------------------------------- /platforms/cc3200/logging_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 2 | #define JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 3 | 4 | #include "ulogger.h" 5 | 6 | #define ULOGGER_PLATFORM PLATFORM_CC3200 7 | 8 | #define JUMPER_API_VERSION "3.0" 9 | #define JUMPER_PROJECT_ID "000000000000000000000000" 10 | #define JUMPER_WRITE_KEY "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" 11 | 12 | #define API_HANDLER_LOG_SEND_PERIOD 5000 13 | #define API_HANDLER_BUFFER_SIZE 300 14 | #define API_HANDLE_JSON_ENCODER_BUFFER_SIZE 200 15 | #define EVENTS_API_HANDLER_STACK_SIZE 1000 16 | 17 | #define ULOGGER_ENTER_CRITICAL_SECTION() osi_EnterCritical() 18 | #define ULOGGER_EXIT_CRITICAL_SECTION() osi_ExitCritical(0) 19 | 20 | #endif //JUMPER_ULOGGER_LOGGING_CONFIG_SAMPLE_H_H 21 | -------------------------------------------------------------------------------- /test/test_module/test_ulogger.c: -------------------------------------------------------------------------------- 1 | #include "unity_fixture.h" 2 | #include "mock_user_handlers.h" 3 | #include "ulogger.h" 4 | 5 | #define STRING_TO_SEND "HELLO" 6 | 7 | TEST_GROUP(TestLogger); 8 | 9 | uLogger ulogger; 10 | 11 | TEST_SETUP(TestLogger) { 12 | init_user_handlers(); 13 | } 14 | 15 | TEST_TEAR_DOWN(TestLogger) { 16 | } 17 | 18 | TEST(TestLogger, Test_Sanity) { 19 | TEST_ASSERT_EQUAL(ULOGGER_SUCCESS, ulogger_init(&ulogger, log_handlers, handler_data, (size_t) NUM_HANDLERS)); 20 | 21 | TEST_ASSERT_EQUAL(ULOGGER_SUCCESS, ulogger_log(&ulogger, ULOGGER_INFO, DEVICE_BOOT_EVENT, 0, 0)); 22 | assert_counters(0); 23 | TEST_ASSERT_EQUAL(ULOGGER_SUCCESS, ulogger_log(&ulogger, ULOGGER_INFO, DEVICE_BOOT_EVENT, 0, 0)); 24 | assert_counters(1); 25 | TEST_ASSERT_EQUAL(ULOGGER_SUCCESS, ULOGGEER_LOG_STRING(&ulogger, ULOGGER_DEBUG, DEVICE_BOOT_EVENT, STRING_TO_SEND)); 26 | TEST_ASSERT_EQUAL_STRING(STRING_TO_SEND, retrieved_string); 27 | } 28 | -------------------------------------------------------------------------------- /ulogger/ulogger_events.h: -------------------------------------------------------------------------------- 1 | #ifndef ULOGGER_EVENTS_H 2 | #define ULOGGER_EVENTS_H 3 | 4 | #include "compilers.h" 5 | 6 | #define DEVICE_BOOT_EVENT 0 7 | #define RADIO_STATE_EVENT 1 8 | #define ADVERTISING_STATE_EVENT 2 9 | #define ULOGGER_BATTERY_EVENT 3 10 | #define BLE_STATE_EVENT 4 11 | #define WLAN_EVENT 5 12 | 13 | typedef struct { 14 | uint8_t is_on; 15 | } __PACKED radio_state_event_data_t; 16 | 17 | typedef struct { 18 | uint8_t is_on; 19 | } __PACKED advertising_state_event_t; 20 | 21 | typedef struct { 22 | uint8_t level; 23 | } __PACKED battery_state_event_data_t; 24 | 25 | typedef struct { 26 | uint8_t connected; 27 | } __PACKED ble_state_event_t; 28 | 29 | typedef struct { 30 | uint8_t is_connected; 31 | char bssid[33]; //should be configured according to SSID_LEN_MAX 32 | } wlan_event_t; 33 | 34 | #define PLATFORM_EVENTS_START 10000 35 | 36 | #define USER_EVENTS_START 1000000000 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /test/test_module/mock_user_handlers.c: -------------------------------------------------------------------------------- 1 | #include "unity.h" 2 | #include "mock_user_handlers.h" 3 | 4 | static uint32_t timestamp_counter, log_handler_counter; 5 | 6 | void init_user_handlers() { 7 | handler_data[0] = NULL; 8 | log_handlers[0] = (handler_func) &log_handler; 9 | timestamp_counter = (uint32_t) -1; 10 | log_handler_counter = (uint32_t) -1; 11 | } 12 | 13 | void get_timestamp(timestamp *data) { 14 | *data = (timestamp) ++timestamp_counter; 15 | } 16 | 17 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length) { 18 | log_handler_counter = (uint32_t) time; 19 | if (data_length > 0) { 20 | sprintf(retrieved_string, log_data); 21 | } 22 | return HANDLER_SUCCESS; 23 | } 24 | 25 | void assert_counters(uint32_t expected_value) { 26 | TEST_ASSERT_EQUAL(expected_value, timestamp_counter); 27 | TEST_ASSERT_EQUAL(expected_value, log_handler_counter); 28 | } -------------------------------------------------------------------------------- /ulogger/ulogger.c: -------------------------------------------------------------------------------- 1 | #include "ulogger.h" 2 | #include 3 | 4 | uLoggerErrorCode ulogger_init(uLogger *ulogger, handler_func *handlers, void **handlers_data, size_t num_handlers) { 5 | ulogger->handlers = handlers; 6 | ulogger->handlers_data = handlers_data; 7 | ulogger->num_handlers = num_handlers; 8 | 9 | return ULOGGER_SUCCESS; 10 | } 11 | 12 | uLoggerErrorCode ulogger_log(uLogger *ulogger, LogLevel level, EventType event_type, void * log_data, size_t data_length) { 13 | handler_func log_handle; 14 | timestamp time; 15 | HandlerReturnType err_code; 16 | int i; 17 | uLoggerErrorCode return_value = ULOGGER_SUCCESS; 18 | 19 | get_timestamp(&time); 20 | for (i=0; i < ulogger->num_handlers; ++i) { 21 | log_handle = ulogger->handlers[i]; 22 | err_code = (*log_handle)(ulogger->handlers_data[i], level, event_type, time, log_data, data_length); 23 | if (err_code) { 24 | return_value = ULOGGER_FAIL; 25 | } 26 | } 27 | 28 | return return_value; 29 | } -------------------------------------------------------------------------------- /test/test_module/tests_runner.c: -------------------------------------------------------------------------------- 1 | #include "unity_fixture.h" 2 | 3 | TEST_GROUP_RUNNER(TestLogger) { 4 | RUN_TEST_CASE(TestLogger, Test_Sanity); 5 | } 6 | 7 | TEST_GROUP_RUNNER(TestUbuffer) { 8 | RUN_TEST_CASE(TestUbuffer, Test_Init); 9 | RUN_TEST_CASE(TestUbuffer, Test_Allocate); 10 | RUN_TEST_CASE(TestUbuffer, Test_Free); 11 | RUN_TEST_CASE(TestUbuffer, Test_Full); 12 | RUN_TEST_CASE(TestUbuffer, Test_Empty); 13 | RUN_TEST_CASE(TestUbuffer, Test_Circular_Tail); 14 | RUN_TEST_CASE(TestUbuffer, Test_Circular_Head); 15 | RUN_TEST_CASE(TestUbuffer, Test_Free_Size_0); 16 | RUN_TEST_CASE(TestUbuffer, Test_Free_Size_0_When_Empty); 17 | RUN_TEST_CASE(TestUbuffer, Test_Free_Item_Too_Large); 18 | RUN_TEST_CASE(TestUbuffer, Test_Free_Item_Too_Large_With_Empty_Bytes_At_End); 19 | RUN_TEST_CASE(TestUbuffer, Test_Peek); 20 | RUN_TEST_CASE(TestUbuffer, Test_Nrf_Scenario); 21 | } 22 | 23 | static void RunAllTests(void) 24 | { 25 | RUN_TEST_GROUP(TestLogger); 26 | RUN_TEST_GROUP(TestUbuffer); 27 | } 28 | 29 | int main(int argc, const char * argv[]) 30 | { 31 | return UnityMain(argc, argv, RunAllTests); 32 | } 33 | -------------------------------------------------------------------------------- /porting.md: -------------------------------------------------------------------------------- 1 | # Porting Guide 2 | If your platform is not supported. You can create a µlogger port for your platform. 3 | 4 | 1. Add _"ulogger.h"_ and _"ulogger.c"_ to your project 5 | 2. `include "ulogger.h"` 6 | 3. Create log handlers: 7 | ```c 8 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length) { 9 | printf("Received event at %d\n", time); 10 | return HANDLER_SUCCESS; 11 | } 12 | ``` 13 | 4. Create a timestamp function (varies by platform): 14 | ```c 15 | #include 16 | 17 | void get_timestamp(timestamp *data) { 18 | struct timeval tv; 19 | gettimeofday(&tv,NULL); 20 | *data = (timestamp) tv.tv_sec; 21 | } 22 | ``` 23 | 5. Declare a µlogger struct, such as `uLogger logger` 24 | 6. Initialize it with any number of handlers - "print to uart" handlers, "send to network" handlers, the sky is the limit! 25 | ```c 26 | handler_func log_handlers[0]; 27 | void* handler_data[NUM_HANDLERS]; 28 | 29 | log_handlers[0] = (handler_func) &log_handler; 30 | handler_data[0] = NULL; 31 | ulogger_init(logger, log_handlers, handler_data, (size_t) 1); 32 | ``` 33 | 7. You can now start logging! -------------------------------------------------------------------------------- /samples/cc3200-sample/targetConfigs/CC3200.ccxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /platforms/cc3200/json_encoding_helper.h: -------------------------------------------------------------------------------- 1 | /**@file 2 | * @brief Hlper methods for json encoding. 3 | * @ingroup cc3200_platform 4 | * @{ 5 | */ 6 | #ifndef JSON_ENCODING_HELPER_H 7 | #define JSON_ENCODING_HELPER_H 8 | 9 | #define START_ARRAY(buf, name) \ 10 | do { \ 11 | (buf)+= sprintf((buf), "\"%s\": [", name); \ 12 | } while(0); 13 | 14 | #define END_ARRAY(buf) \ 15 | do { \ 16 | (buf)+= sprintf((buf), "], "); \ 17 | } while(0); 18 | 19 | #define START_OBJECT(buf) \ 20 | do { \ 21 | (buf)+= sprintf((buf), "{"); \ 22 | } while(0); 23 | 24 | #define END_OBJECT(buf) \ 25 | do { \ 26 | (buf) -= 2; \ 27 | (buf) += sprintf((buf), "}"); \ 28 | } while(0); 29 | 30 | #define PACK_NAME_AND_INT(buf, obj, param) \ 31 | (buf) += sprintf((buf), "\"%s\": %d, ", #param, (obj)->param) 32 | 33 | 34 | #define PACK_NAME_AND_STRING(buf, obj, param) \ 35 | (buf) += sprintf((buf), "\"%s\": \"%s\", ", #param, (obj)->param) 36 | 37 | #define PACK_NAME_AND_MAC_ADDRESS(buf, field_name, mac) \ 38 | (buf) += sprintf((buf), "\"%s\": \"%x:%x:%x:%x:%x:%x\", ", field_name, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]) 39 | 40 | #define PACK_EVENT_NAME(name) #name 41 | 42 | #endif //JSON_ENCODING_HELPER_H 43 | /** 44 | /* @} 45 | */ 46 | -------------------------------------------------------------------------------- /ulogger/network_log_handler.h: -------------------------------------------------------------------------------- 1 | #ifndef NETWORK_LOG_HANDLER 2 | #define NETWORK_LOG_HANDLER 3 | 4 | #include 5 | #include "compilers.h" 6 | #include "ubuffer.h" 7 | 8 | typedef struct { 9 | uint8_t version; 10 | EventType event_type; 11 | timestamp time; 12 | uint8_t data_length; 13 | } __PACKED uLoggerEventHeader; 14 | 15 | typedef int (*send_to_network)(void * network_context, uint8_t * data, uint32_t length); 16 | typedef bool (*can_send_to_network)(void * network_context); 17 | typedef void (*periodic_callback_function)(void * config); 18 | typedef int (*formatter)(void * formatter_context, uLoggerEventHeader * event, 19 | uint8_t ** formatted_event, size_t * formatted_event_length); 20 | 21 | typedef struct { 22 | uint32_t log_send_period; 23 | void * context; 24 | send_to_network send; 25 | can_send_to_network can_send; 26 | periodic_callback_function callback; 27 | uBuffer buffer; 28 | formatter format_method; 29 | void * formatter_context; 30 | } network_log_config; 31 | 32 | #define NETWORK_LOGGER_VERSION 1 33 | 34 | int network_logger_init(network_log_config * config, uint8_t * buffer, size_t buffer_size); 35 | 36 | void netowork_logger_periodic_callback(void * data); 37 | 38 | HandlerReturnType network_handler_log(void * context, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10028/s130/iar/ble_app_template_iar_nRF5x.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x1b000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x1b000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20001fe8; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20007fff; 11 | export symbol __ICFEDIT_region_RAM_start__; 12 | export symbol __ICFEDIT_region_RAM_end__; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | define memory mem with size = 4G; 19 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 20 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 21 | 22 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 23 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 24 | 25 | initialize by copy { readwrite }; 26 | do not initialize { section .noinit }; 27 | 28 | keep { section .intvec }; 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | place in ROM_region { readonly }; 31 | place in RAM_region { readwrite, 32 | block CSTACK, 33 | block HEAP }; 34 | 35 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10040/s132/iar/ble_app_template_iar_nRF5x.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x1f000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x1f000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x7ffff; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20002128; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000ffff; 11 | export symbol __ICFEDIT_region_RAM_start__; 12 | export symbol __ICFEDIT_region_RAM_end__; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | define memory mem with size = 4G; 19 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 20 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 21 | 22 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 23 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 24 | 25 | initialize by copy { readwrite }; 26 | do not initialize { section .noinit }; 27 | 28 | keep { section .intvec }; 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | place in ROM_region { readonly }; 31 | place in RAM_region { readwrite, 32 | block CSTACK, 33 | block HEAP }; 34 | 35 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10056/s132/iar/ble_app_template_iar_nRF5x.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x1f000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x1f000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0xfffff; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20002128; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x2003ffff; 11 | export symbol __ICFEDIT_region_RAM_start__; 12 | export symbol __ICFEDIT_region_RAM_end__; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x200; 16 | /**** End of ICF editor section. ###ICF###*/ 17 | 18 | define memory mem with size = 4G; 19 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 20 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 21 | 22 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 23 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 24 | 25 | initialize by copy { readwrite }; 26 | do not initialize { section .noinit }; 27 | 28 | keep { section .intvec }; 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | place in ROM_region { readonly }; 31 | place in RAM_region { readwrite, 32 | block CSTACK, 33 | block HEAP }; 34 | 35 | -------------------------------------------------------------------------------- /platforms/cc3200/events_api_handler.h: -------------------------------------------------------------------------------- 1 | /**@file 2 | * @brief Events api handler. 3 | * The events log handler forwards logging events directly to jumper's logging api. 4 | * @ingroup cc3200_platform 5 | * @{ 6 | */ 7 | #ifndef EVENTS_API_HANDLER_H 8 | #define EVENTS_API_HANDLER_H 9 | 10 | #include 11 | #include 12 | #include "ulogger.h" 13 | #include "network_log_handler.h" 14 | #include "json_formatter.h" 15 | 16 | /** 17 | * @brief Initializes the event logging handler 18 | * @param config A pointer to an instance of network_log_config 19 | * @param event_buffer A buffer for storing the data before sending it in large chunks to the server. Increasing the buffer size means you can wait 20 | * more between bursts. 21 | * @param event_buffer_size The size of the given buffer. 22 | * @param context A pointer to an instance of json_formatter_context 23 | * @param encoding_buffer A buffer to be used when encoding events to json. The buffer must be large enough to accomedate the longest json string that can be created 24 | * from encoding the events. 25 | * @param encoding_buffer_size the size of the given encoding buffer. 26 | * @return 0 on success, error code otherwise. */ 27 | int events_api_handler_init(network_log_config * config, uint8_t * event_buffer, size_t event_buffer_size, json_formatter_context * context, uint8_t * encoding_buffer, size_t encoding_buffer_size); 28 | 29 | /** 30 | * @brief Handler implementation for the events api handler (as defined in network_log_handler.h) 31 | */ 32 | HandlerReturnType events_api_handler_handle_log(void * handler_data, LogLevel level, EventType event_type, timestamp time, void * data, size_t data_length); 33 | 34 | #endif //EVENTS_API_HANDLER_H 35 | /** 36 | * @} 37 | */ 38 | -------------------------------------------------------------------------------- /platforms/nrf52/trace_nrf52.c: -------------------------------------------------------------------------------- 1 | #include "logging_config.h" 2 | 3 | #if ULOGGER_PLATFORM == PLATFORM_NRF52 4 | 5 | #include "trace_nrf52.h" 6 | #include "ulogger.h" 7 | 8 | extern uLogger NRF_BLE_LOGGER; 9 | void ulogger_trace_nrf_ble_event(ble_evt_t *p_ble_evt) { 10 | ble_state_event_t state; 11 | switch (p_ble_evt->header.evt_id) { 12 | case BLE_GAP_EVT_CONNECTED: 13 | state.connected = 1; 14 | break; 15 | case BLE_GAP_EVT_DISCONNECTED: 16 | state.connected = 0; 17 | break; 18 | default: 19 | return; //not tracking other events now 20 | } 21 | ulogger_log(&NRF_BLE_LOGGER, ULOGGER_INFO, BLE_STATE_EVENT, &state, sizeof(state)); 22 | } 23 | 24 | void ulogger_trace_nrf_ble_adv_event(ble_adv_evt_t ble_adv_evt) { 25 | advertising_state_event_t state; 26 | switch (ble_adv_evt) { 27 | case BLE_ADV_EVT_DIRECTED: /**< Direct advertising mode has started. */ 28 | case BLE_ADV_EVT_DIRECTED_SLOW: /**< Directed advertising (low duty cycle) has started. */ 29 | case BLE_ADV_EVT_FAST: /**< Fast advertising mode has started. */ 30 | case BLE_ADV_EVT_SLOW: /**< Slow advertising mode has started. */ 31 | case BLE_ADV_EVT_FAST_WHITELIST: /**< Fast advertising mode using the whitelist has started. */ 32 | case BLE_ADV_EVT_SLOW_WHITELIST: 33 | state.is_on = 1; 34 | break; 35 | case BLE_ADV_EVT_IDLE: 36 | state.is_on = 0; 37 | break; 38 | 39 | case BLE_ADV_EVT_WHITELIST_REQUEST: 40 | case BLE_ADV_EVT_PEER_ADDR_REQUEST: 41 | return; // ignore for now 42 | } 43 | 44 | ulogger_log(&NRF_BLE_LOGGER, ULOGGER_INFO, ADVERTISING_STATE_EVENT, &state, sizeof(state)); 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /platforms/cc3200/json_formatter.c: -------------------------------------------------------------------------------- 1 | #include "json_formatter.h" 2 | #include "json_encoding_helper.h" 3 | #include "logging_config.h" 4 | #include "netcfg.h" 5 | #include 6 | #include 7 | 8 | 9 | #define PACK_EVENT_TYPE(buf, type) \ 10 | (buf) += sprintf((buf), "\"event\": \"%s\", ", #type) 11 | 12 | 13 | int json_formatter_format(void * formatter_context, uLoggerEventHeader * event, 14 | uint8_t ** formatted_event, size_t * formatted_event_length) { 15 | 16 | json_formatter_context * context = (json_formatter_context *) formatter_context; 17 | uint8_t * additional_data = ((uint8_t*)event) + sizeof(uLoggerEventHeader); 18 | _u8 mac_address[SL_MAC_ADDR_LEN]; 19 | _u8 macAddressLen = SL_MAC_ADDR_LEN; 20 | sl_NetCfgGet(SL_MAC_ADDRESS_GET,(_u8 *)NULL,&macAddressLen, mac_address); 21 | 22 | memset(context->buffer, 0, context->buffer_length); 23 | uint8_t * buf = context->buffer; 24 | START_OBJECT(buf); 25 | START_ARRAY(buf, JUMPER_PROJECT_ID); 26 | START_OBJECT(buf); 27 | PACK_NAME_AND_MAC_ADDRESS(buf, "device_id", mac_address); 28 | switch (event->event_type) { 29 | case DEVICE_BOOT_EVENT: 30 | PACK_EVENT_TYPE(buf, DEVICE_STARTED_EVENT); 31 | break; 32 | case WLAN_EVENT: 33 | { 34 | wlan_event_t * event_metadata = (wlan_event_t *) additional_data; 35 | PACK_EVENT_TYPE(buf, WLAN_EVENT); 36 | PACK_NAME_AND_INT(buf, event_metadata, is_connected); 37 | PACK_NAME_AND_STRING(buf, event_metadata, bssid); 38 | } 39 | break; 40 | default: 41 | { 42 | return -1; 43 | } 44 | } 45 | END_OBJECT(buf) 46 | END_ARRAY(buf); 47 | END_OBJECT(buf) 48 | *formatted_event = context->buffer; 49 | *formatted_event_length = buf - context->buffer; 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jumper µLogger 2 | This project is part of the Jumper Insights framework. Visit https://www.jumper.io/insights/ for more information. 3 | 4 | Jumper µLogger is a lightweight and extensible logging and analytics tool designed with embedded development in mind, with a tiny footprint. 5 | 6 | ## Documentation 7 | http://docs.jumper.io 8 | 9 | ## Samples and platforms 10 | Currently we support nRF52 logging with a GATT service out of the box. Samples and further documentation available [here](https://github.com/Jumperr-labs/jumper-ulogger/tree/master/platforms/nrf52). 11 | 12 | ## µLogger Events 13 | µLogger is made for logging in embedded software, RTOS or bare-metal firmware. µLogger should be used for logging structured data such as battery level, radio events, interrupts, etc. µLogger should not be used for logging arbitrary data such as customized strings. 14 | 15 | Event types and data structures can be easily defined in the _"ulogger_events.h"_ file. Here is an example: 16 | ```c 17 | #define ULOGGER_BATTERY_EVENT 3 18 | 19 | typedef struct { 20 | uint8_t level; 21 | } battery_state_event_data_t; 22 | ``` 23 | 24 | ## Using the µLogger 25 | - Define your events in the _"ulogger_events.h"_ file (Check it out for examples) 26 | - API for logging events: 27 | 28 | `uLoggerErrorCode ulogger_log (void *ulogger, LogLevel level, EventType event_type, void *log_data, size_t data_length)` 29 | 30 | - example: 31 | - You can log simple events with no data: 32 | 33 | `ULOGGER_LOG(&ulogger, ULOGGER_INFO, DEVICE_STARTED_EVENT);` 34 | 35 | - Or you can log more complex events such as: 36 | ```c 37 | battery_level.level = 91; 38 | ulogger_log(&ulogger, ULOGGER_INFO, ULOGGER_BATTERY_EVENT, &battery_level, 1); 39 | ``` 40 | 41 | ## Porting 42 | Check out our [porting guide](https://github.com/Jumperr-labs/jumper-ulogger/blob/master/porting.md) 43 | 44 | ## Contribute 45 | Feel free to open issues and send us your pull requests. 46 | 47 | ## Contact Us 48 | We are happy to help! Feel free to contact us about any issue and give us your feedback at [info@jumper.io](mailto:info@jumper.io) 49 | -------------------------------------------------------------------------------- /platforms/nrf52/gatt_handler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief Handler implementation for sending data over GATT to the HCI proxy. 4 | * The GATT handler handles everything related to initialising its own service, charactaristic, and managing the supplied buffer. 5 | * @defgroup nrf52_platform nRF52 Platform 6 | * @{ 7 | */ 8 | #ifndef JUMPER_ULOGGER_GATT_HANDLER_H 9 | #define JUMPER_ULOGGER_GATT_HANDLER_H 10 | #include "logging_config.h" 11 | 12 | #if ULOGGER_PLATFORM == PLATFORM_NRF52 13 | 14 | #include "network_log_handler.h" 15 | #include "ble.h" 16 | #include "ulogger.h" 17 | #include 18 | 19 | typedef struct { 20 | uint16_t connection_handle; 21 | uint16_t service_handle; 22 | bool is_waiting_for_tx_complete; 23 | uint8_t uuid_type; 24 | ble_gatts_char_handles_t send_char_handles; 25 | ble_gatts_char_handles_t time_char_handle; 26 | } uLoggerGattHandler; 27 | 28 | /** 29 | * @brief Initialize the GATT handler with the supplied buffer. 30 | * @param buffer A buffer for storing the data before sending it in large chunks to the server. Increasing the buffer size means you can wait 31 | * more between bursts. 32 | * @param buffer_length The size of the given buffer. 33 | * @return 0 on success, error code otherwise. 34 | */ 35 | uint32_t gatt_handler_init(network_log_config * config, uint8_t * buffer, uint32_t buffer_length); 36 | 37 | /** 38 | * @brief A log handler, saves a logging event into a buffer. 39 | * @param handler_data A pointer to the network_log_config 40 | * @param level 41 | * @param event_type 42 | * @param time 43 | * @param data Event data 44 | * @param data_length Size of data in bytes 45 | * @return HANDLER_SUCCESS or HANDLER_FAIL 46 | */ 47 | HandlerReturnType gatt_handler_handle_log(void * handler_data, LogLevel level, EventType event_type, timestamp time, void * data, size_t data_length); 48 | 49 | /** 50 | * A callback function that needs to be called with an event from the soft device. 51 | * @param p_ble_evt 52 | * @param handler 53 | */ 54 | void gatt_handler_handle_ble_event(ble_evt_t *p_ble_evt, uLoggerGattHandler * handler); 55 | 56 | #endif 57 | 58 | #endif //JUMPER_ULOGGER_GATT_HANDLER_H 59 | /** 60 | * @} 61 | */ -------------------------------------------------------------------------------- /doxygen-bootstrapped/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | $projectname: $title 15 | $title 16 | 17 | 18 | $treeview 19 | $search 20 | $mathjax 21 | 22 | $extrastylesheet 23 | 24 | 25 | 26 | 27 | 28 | 29 | 36 |
37 |
38 |
39 |
40 |
41 |
42 | 43 | -------------------------------------------------------------------------------- /samples/cc3200-sample/pinmux.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // pinmux.h 3 | // 4 | // function prototype for pinmuxconfig 5 | // 6 | // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 13 | // Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright 17 | // notice, this list of conditions and the following disclaimer in the 18 | // documentation and/or other materials provided with the 19 | // distribution. 20 | // 21 | // Neither the name of Texas Instruments Incorporated nor the names of 22 | // its contributors may be used to endorse or promote products derived 23 | // from this software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | // 37 | //***************************************************************************** 38 | 39 | // This file was automatically generated on 7/21/2014 at 3:06:20 PM 40 | // by TI PinMux version 3.0.334 41 | // 42 | //***************************************************************************** 43 | 44 | #ifndef __PINMUX_H__ 45 | #define __PINMUX_H__ 46 | 47 | extern void PinMuxConfig(void); 48 | 49 | #endif // __PINMUX_H__ 50 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10028/s130/arm4/ble_app_template_pca10028_s130.uvopt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | nrf51422_xxac 9 | 0x4 10 | ARM-ADS 11 | 12 | 1 13 | 14 | Segger\JL2CM3.dll 15 | 16 | 17 | 18 | 0 19 | JL2CM3 20 | -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 21 | 22 | 23 | 0 24 | UL2CM3 25 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf51xxx -FS00 -FL0200000) 26 | 27 | 28 | 29 | 30 | flash_s130_nrf51_2.0.1_softdevice 31 | 0x4 32 | ARM-ADS 33 | 34 | Segger\JL2CM3.dll 35 | 36 | 37 | 38 | 0 39 | JL2CM3 40 | -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf51xxx_ecb -FS00 -FL0200000 41 | 42 | 43 | 0 44 | UL2CM3 45 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf51xxx -FS00 -FL0200000) 46 | 47 | 48 | 49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10040/s132/arm4/ble_app_template_pca10040_s132.uvopt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | nrf52832_xxaa 9 | 0x4 10 | ARM-ADS 11 | 12 | 1 13 | 14 | Segger\JL2CM3.dll 15 | 16 | 17 | 18 | 0 19 | JL2CM3 20 | -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf52xxx -FS00 -FL0200000 -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 21 | 22 | 23 | 0 24 | UL2CM3 25 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000) 26 | 27 | 28 | 29 | 30 | flash_s132_nrf52_3.0.0_softdevice 31 | 0x4 32 | ARM-ADS 33 | 34 | Segger\JL2CM3.dll 35 | 36 | 37 | 38 | 0 39 | JL2CM3 40 | -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf52xxx_ecb -FS00 -FL0200000 -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 41 | 42 | 43 | 0 44 | UL2CM3 45 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000) 46 | 47 | 48 | 49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10056/s132/arm4/ble_app_template_pca10056_s132.uvopt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | nrf52840_xxaa 9 | 0x4 10 | ARM-ADS 11 | 12 | 1 13 | 14 | Segger\JL2CM3.dll 15 | 16 | 17 | 18 | 0 19 | JL2CM3 20 | -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf52xxx -FS00 -FL0200000 -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 21 | 22 | 23 | 0 24 | UL2CM3 25 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000) 26 | 27 | 28 | 29 | 30 | flash_s132_nrf52_3.0.0_softdevice 31 | 0x4 32 | ARM-ADS 33 | 34 | Segger\JL2CM3.dll 35 | 36 | 37 | 38 | 0 39 | JL2CM3 40 | -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf52xxx_ecb -FS00 -FL0200000 -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 41 | 42 | 43 | 0 44 | UL2CM3 45 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000) 46 | 47 | 48 | 49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /ulogger/ubuffer.h: -------------------------------------------------------------------------------- 1 | /**@file 2 | * @brief Buffer implementation for use in networking loggers. 3 | * 4 | * @defgroup ubuffer uBuffer helper 5 | * @{ 6 | */ 7 | #ifndef UBUFFER 8 | #define UBUFFER 9 | 10 | #include 11 | #include 12 | #include "ulogger.h" 13 | 14 | typedef struct { 15 | char *start; 16 | size_t head; 17 | size_t size; 18 | size_t capacity; 19 | size_t num_empty_bytes_at_end; 20 | } uBuffer; 21 | 22 | /** 23 | * @brief Return codes for various uBuffer methods 24 | */ 25 | typedef enum { 26 | UBUFFER_SUCCESS = 0, 27 | UBUFFER_FULL, 28 | UBUFFER_EMPTY 29 | } uBufferErrorCode; 30 | 31 | /** 32 | * @brief Initialize a given uBuffer instance with the supplied buffer. 33 | * 34 | * @param ubuffer The buffer structure memory. 35 | * @param start Pointer to a start of the array to be used as a buffer. 36 | * @param buffer_capacity The length of the previous array. 37 | * @returns UBUFFER_SUCCESS if successful, otherwise an error code is returned. 38 | */ 39 | uBufferErrorCode ubuffer_init(uBuffer *ubuffer, char *start, size_t buffer_capacity); 40 | 41 | /** 42 | * @brief Allocates memory at the end of the buffer 43 | * @param ubuffer An initialized uBuffer instance 44 | * @param item A pointer to a pointer that will be initialized to an allocated memory 45 | * @param item_size The size of the memory to allocate 46 | * @return UBUFFER_SUCCESS if successful, otherwise an error code is returned. 47 | */ 48 | uBufferErrorCode ubuffer_allocate_next(uBuffer *ubuffer, void **item, size_t item_size); 49 | 50 | /** 51 | * @brief Free item_size amount of memory from the beginning of the buffer 52 | * @param ubuffer An initialized uBuffer instance 53 | * @param item A pointer to the begining of the release memory 54 | * @param item_size The size of the memory to release 55 | * @return UBUFFER_SUCCESS if successful, otherwise an error code is returned. 56 | */ 57 | uBufferErrorCode ubuffer_free_first(uBuffer *ubuffer, void **item, size_t item_size); 58 | 59 | /** 60 | * @brief Peeks at the first item in the buffer 61 | * @param ubuffer An initialized uBuffer instance 62 | * @param item A pointer to a pointer that will be initialized to the start of the first item 63 | * @param item_size The length of the item to be peeked 64 | * @return UBUFFER_SUCCESS if successful, otherwise an error code is returned. 65 | */ 66 | uBufferErrorCode ubuffer_peek_first(uBuffer *ubuffer, void **item, size_t item_size); 67 | 68 | #endif //UBUFFER 69 | 70 | /** 71 | * @} 72 | */ 73 | -------------------------------------------------------------------------------- /ulogger/network_log_handler.c: -------------------------------------------------------------------------------- 1 | #include "network_log_handler.h" 2 | #include "ubuffer.h" 3 | #include 4 | #include 5 | #include "network_log_handler.h" 6 | 7 | HandlerReturnType network_handler_log(void * context, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length) { 8 | uLoggerEventHeader * stored_event = NULL; 9 | network_log_config * config = (network_log_config*) context; 10 | if (ubuffer_allocate_next(&config->buffer, (void **)&stored_event, sizeof(uLoggerEventHeader) + data_length)) { 11 | return HANDLER_FAIL; 12 | } 13 | 14 | stored_event->version = NETWORK_LOGGER_VERSION; 15 | stored_event->time = time; 16 | stored_event->event_type = event_type; 17 | stored_event->data_length = data_length; 18 | //TODO check that length matches with body length 19 | if (data_length > 0) { 20 | memcpy((void*)(((uint8_t*)stored_event) + sizeof(uLoggerEventHeader)), log_data, data_length); 21 | } 22 | 23 | return HANDLER_SUCCESS; 24 | } 25 | 26 | void netowork_logger_periodic_callback(void * data) { 27 | int err_code; 28 | uLoggerEventHeader * event; 29 | network_log_config * config = (network_log_config *) data; 30 | 31 | while (config->can_send(config->context) && 32 | ubuffer_peek_first(&config->buffer, (void**)&event, sizeof(uLoggerEventHeader)) == UBUFFER_SUCCESS) { 33 | size_t len = sizeof(uLoggerEventHeader) + event->data_length; 34 | size_t formatted_length; 35 | if (config->format_method != NULL) { 36 | uint8_t * formatted_event; 37 | err_code = config->format_method(config->formatter_context, event, &formatted_event, &formatted_length); 38 | if (err_code) { //Can't format event, throw it away 39 | //TODO add a log event that we threw away an event 40 | err_code = 0; 41 | } else { 42 | err_code = config->send(config->context, (void *) formatted_event, formatted_length); 43 | } 44 | } else { 45 | err_code = config->send(config->context, (void *) event, len); 46 | } 47 | 48 | if (err_code) { 49 | return; 50 | } 51 | ubuffer_free_first(&config->buffer, (void**)&event, len); 52 | } 53 | } 54 | 55 | int network_logger_init(network_log_config * config, uint8_t * buffer, size_t buffer_size) { 56 | ubuffer_init(&config->buffer, (char *)buffer, buffer_size); 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /platforms/cc3200/events_api_handler.c: -------------------------------------------------------------------------------- 1 | #include "events_api_handler.h" 2 | #include "ulogger.h" 3 | #include "network_log_handler.h" 4 | #include "http_client.h" 5 | #include "keen_client.h" 6 | #include "logging_config.h" 7 | #include "common.h" 8 | #include "json_encoding_helper.h" 9 | 10 | char *api_version = JUMPER_API_VERSION; 11 | char *project_id = JUMPER_PROJECT_ID; 12 | char *write_key = JUMPER_WRITE_KEY; 13 | 14 | extern uint32_t g_ulStatus; 15 | 16 | #undef send 17 | 18 | static int events_api_handler_send(void * network_context, uint8_t * data, uint32_t length); 19 | static bool events_api_handler_can_send(void * network_context); 20 | static int events_api_handler_timer_start(network_log_config * config); 21 | 22 | int events_api_handler_init(network_log_config * config, uint8_t * event_buffer, size_t event_buffer_size, json_formatter_context * context, uint8_t * encoding_buffer, size_t encoding_buffer_size) { 23 | context->buffer = encoding_buffer; 24 | context->buffer_length = encoding_buffer_size; 25 | 26 | config->log_send_period = API_HANDLER_LOG_SEND_PERIOD; 27 | config->context = (void *) NULL; 28 | config->send = events_api_handler_send; 29 | config->can_send = events_api_handler_can_send; 30 | config->callback = netowork_logger_periodic_callback; 31 | config->formatter_context = context; 32 | config->format_method = json_formatter_format; 33 | network_logger_init(config, event_buffer, event_buffer_size); 34 | events_api_handler_timer_start(config); 35 | 36 | return 0; 37 | } 38 | 39 | static bool events_api_handler_can_send(void * network_context) { 40 | return IS_CONNECTED(g_ulStatus) && IS_IP_ACQUIRED(g_ulStatus); 41 | } 42 | 43 | static int events_api_handler_send(void * network_context, uint8_t * data, uint32_t length) { 44 | int error_code = add_events(data); 45 | UART_PRINT("Sending data....... %d\n", error_code); 46 | return error_code; 47 | } 48 | 49 | static void periodic_caller(void * parameters) { 50 | network_log_config * config = (network_log_config *) parameters; 51 | while (1) { 52 | osi_Sleep(config->log_send_period); 53 | config->callback(parameters); 54 | } 55 | } 56 | 57 | HandlerReturnType events_api_handler_handle_log(void * handler_data, LogLevel level, EventType event_type, timestamp time, void * data, size_t data_length) { 58 | network_handler_log((network_log_config *)handler_data, level, event_type, time, data, data_length); 59 | return HANDLER_SUCCESS; 60 | } 61 | 62 | 63 | static int events_api_handler_timer_start(network_log_config * config) { 64 | osi_TaskCreate(periodic_caller, (const signed char*)"Send Buffer Task",EVENTS_API_HANDLER_STACK_SIZE ,(void*)config, 1, NULL); 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /platforms/cc3200/ulogger_cc3200.c: -------------------------------------------------------------------------------- 1 | #include "logging_config.h" 2 | 3 | #if ULOGGER_PLATFORM == PLATFORM_CC3200 4 | 5 | #include "ulogger.h" 6 | #include "events_api_handler.h" 7 | #include "network_log_handler.h" 8 | 9 | // Driverlib includes 10 | #include "hw_types.h" 11 | #include "interrupt.h" 12 | #include "hw_ints.h" 13 | #include "hw_apps_rcm.h" 14 | #include "hw_common_reg.h" 15 | #include "prcm.h" 16 | #include "rom.h" 17 | #include "rom_map.h" 18 | #include "hw_memmap.h" 19 | #include "timer.h" 20 | #include "utils.h" 21 | #include 22 | #include "osi.h" 23 | #include "common.h" 24 | #include "timer_if.h" 25 | 26 | #define ULOGGER_STACK_SIZE 1024 27 | 28 | static volatile unsigned long timer_base; 29 | static volatile unsigned long timer_timestamp = 0; 30 | 31 | static json_formatter_context json_context = {0}; 32 | static network_log_config events_api_handler_config = {0}; 33 | static uint8_t events_api_buffer[API_HANDLER_BUFFER_SIZE]; 34 | static uint8_t json_encoding_buffer[API_HANDLE_JSON_ENCODER_BUFFER_SIZE]; 35 | 36 | static char * log_level_strings[] = { 37 | "DEBUG", 38 | "INFO", 39 | "WARNING", 40 | "ERROR", 41 | "FATAL" 42 | }; 43 | 44 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length); 45 | 46 | static handler_func log_handlers[] = {&log_handler, &network_handler_log}; 47 | static void * handler_data[] = {NULL, &events_api_handler_config}; 48 | 49 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length) { 50 | UART_PRINT("Level: %s, Event: %d, Time: %d\r\n", (uint32_t)log_level_strings[level], event_type, time); 51 | return HANDLER_SUCCESS; 52 | } 53 | 54 | void LoggingTimerHandler(void) 55 | { 56 | Timer_IF_InterruptClear(timer_base); 57 | timer_timestamp ++; 58 | } 59 | 60 | static void timer_init() { 61 | timer_base = TIMERA0_BASE; 62 | Timer_IF_Init(PRCM_TIMERA0, timer_base, TIMER_CFG_PERIODIC, TIMER_A, 0); 63 | Timer_IF_IntSetup(timer_base, TIMER_A, LoggingTimerHandler); 64 | Timer_IF_Start(timer_base, TIMER_A, 1000); 65 | } 66 | 67 | void get_timestamp(timestamp* time) 68 | { 69 | *time = (timestamp) timer_timestamp; 70 | } 71 | 72 | void ulogger_init_cc3200(uLogger * logger) { 73 | timer_init(); 74 | events_api_handler_init(&events_api_handler_config, &events_api_buffer, API_HANDLER_BUFFER_SIZE, &json_context, &json_encoding_buffer, API_HANDLE_JSON_ENCODER_BUFFER_SIZE); 75 | ulogger_init(logger, log_handlers, handler_data, (size_t) 2); 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /platforms/nrf52/ulogger_nrf52.c: -------------------------------------------------------------------------------- 1 | #include "logging_config.h" 2 | 3 | #if ULOGGER_PLATFORM == PLATFORM_NRF52 4 | 5 | #include 6 | #include "nrf_drv_rtc.h" 7 | 8 | #define NRF_LOG_MODULE_NAME "ULOGGER" 9 | #include "nrf_log.h" 10 | #include "ulogger_nrf52.h" 11 | #include "gatt_handler.h" 12 | #include "trace_nrf52.h" 13 | #include "network_log_handler.h" 14 | #include "app_timer.h" 15 | 16 | APP_TIMER_DEF(track_seconds_timer); 17 | 18 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * data, size_t data_length); 19 | 20 | static timestamp time_from_boot = 0; 21 | static uLoggerGattHandler handler; 22 | network_log_config config; 23 | 24 | static handler_func log_handlers[] = {&log_handler, &gatt_handler_handle_log}; 25 | static void * handler_data[] = {NULL, &config}; 26 | 27 | static uint8_t gatt_buffer_data[GATT_BUFFER_SIZE]; 28 | 29 | static char * log_level_strings[] = { 30 | "DEBUG", 31 | "INFO", 32 | "WARNING", 33 | "ERROR", 34 | "FATAL" 35 | }; 36 | 37 | HandlerReturnType log_handler(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * data,size_t data_length) { 38 | NRF_LOG_INFO("Level %s\r\nEvent: %d\r\nTime: %d\r\n", (uint32_t)log_level_strings[level], event_type, time); 39 | return HANDLER_SUCCESS; 40 | } 41 | 42 | static void seconds_timeout(void * p_context) { 43 | time_from_boot++; 44 | } 45 | 46 | /** @brief Function initialization and configuration of RTC driver instance. 47 | */ 48 | static int timer_config(void) 49 | { 50 | uint32_t err_code; 51 | 52 | err_code = app_timer_create(&track_seconds_timer, APP_TIMER_MODE_REPEATED, seconds_timeout); 53 | if (err_code != NRF_SUCCESS) { 54 | NRF_LOG_INFO("Failed to create timer\n"); 55 | return err_code; 56 | } 57 | 58 | ret_code_t ret_code; 59 | ret_code = app_timer_start(track_seconds_timer, TICKS(1000) , (void *)NULL); 60 | if (ret_code) { 61 | NRF_LOG_INFO("Failed to create timer\n"); 62 | return ret_code; 63 | } 64 | 65 | return NRF_SUCCESS; 66 | } 67 | 68 | void get_timestamp(timestamp* time) 69 | { 70 | *time = (timestamp) time_from_boot; 71 | } 72 | 73 | void ulogger_init_nrf52(uLogger* logger) { 74 | uint32_t err_code; 75 | timer_config(); 76 | 77 | config.context = (void*) &handler; 78 | config.callback = &netowork_logger_periodic_callback; 79 | err_code = gatt_handler_init(&config, gatt_buffer_data, GATT_BUFFER_SIZE); 80 | NRF_LOG_INFO("Got res %d\n", err_code); 81 | ulogger_init(logger, log_handlers, handler_data, (size_t) 2); 82 | } 83 | 84 | 85 | void ulogger_handle_ble_event(ble_evt_t * p_ble_evt) { 86 | 87 | gatt_handler_handle_ble_event(p_ble_evt, &handler); 88 | ulogger_trace_nrf_ble_event(p_ble_evt); 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /tools/package_generator.sh: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/bash 2 | 3 | # ======================================================== 4 | # SETUP 5 | # ======================================================== 6 | pushd `dirname ${BASH_SOURCE[0]}`/.. 7 | 8 | if [[ $1 == '-h' || $1 == '--help' ]] ; then 9 | echo "Usage: package_generator [version]" 10 | echo "Will push to S3 with an appropriate name based on [version]. If no argument is used, will not push to S3" 11 | exit 0 12 | fi 13 | 14 | version=$1 15 | 16 | repo_dir=. 17 | out_dir=/tmp/jumper-ulogger-package-generator 18 | 19 | 20 | # ======================================================== 21 | # NRF52 PACKAGE 22 | # ======================================================== 23 | nrf52_package_dir_name=jumper_ulogger 24 | nrf52_package_dir=${out_dir}/${nrf52_package_dir_name} 25 | 26 | if [ -z $version ] ; then 27 | nrf52_package_zip=${out_dir}/jumper-ulogger-nrf52.zip 28 | else 29 | nrf52_package_zip=${out_dir}/jumper-ulogger-nrf52-${version}.zip 30 | fi 31 | 32 | mkdir -p ${nrf52_package_dir} 33 | 34 | cp ${repo_dir}/ulogger/*.c ${nrf52_package_dir} 35 | cp ${repo_dir}/ulogger/*.h ${nrf52_package_dir} 36 | 37 | cp ${repo_dir}/platforms/nrf52/*.c ${nrf52_package_dir} 38 | cp ${repo_dir}/platforms/nrf52/*.h ${nrf52_package_dir} 39 | 40 | pushd ${nrf52_package_dir}/.. 41 | zip -r ${nrf52_package_zip} `basename ${nrf52_package_dir}` 42 | popd 43 | 44 | if [ ! -z $version ] ; then 45 | s3cmd put ${nrf52_package_zip} s3://jumper-public/ulogger/ 46 | fi 47 | 48 | 49 | # ======================================================== 50 | # NRF52 SAMPLE PROJECT 51 | # ======================================================== 52 | nrf52_sample_dir_src=${repo_dir}/samples/nrf52-ble-sample-project 53 | nrf52_sample_dir_dest=${out_dir}/nrf52-ble-sample-project 54 | if [ -z $version ] ; then 55 | nrf52_sample_zip=${out_dir}/nrf52-ble-sample-project.zip 56 | else 57 | nrf52_sample_zip=${out_dir}/nrf52-ble-sample-project-${version}.zip 58 | fi 59 | nrf52_sample_ulogger_dir=${nrf52_sample_dir_dest}/${nrf52_package_dir_name} 60 | 61 | pushd ${nrf52_sample_dir_src} 62 | make clean 63 | popd 64 | 65 | cp -r ${nrf52_sample_dir_src} ${nrf52_sample_dir_dest} 66 | mkdir -p ${nrf52_sample_ulogger_dir} 67 | 68 | cp -r $nrf52_package_dir $nrf52_sample_dir_dest/ 69 | 70 | sed -E -i "" "s/^.*ULOGGER_DIR +:=.*\$/ULOGGER_DIR := ${nrf52_package_dir_name}/g" ${nrf52_sample_dir_dest}/Makefile 71 | sed -E -i "" "s/^.*PLATFORM_DIR +:=.*\$/PLATFORM_DIR := ${nrf52_package_dir_name}/g" ${nrf52_sample_dir_dest}/Makefile 72 | 73 | pushd ${nrf52_sample_dir_dest}/.. 74 | zip -r ${nrf52_sample_zip} `basename ${nrf52_sample_dir_dest}` 75 | popd 76 | 77 | if [ ! -z $version ] ; then 78 | s3cmd put ${nrf52_sample_zip} s3://jumper-public/ulogger/ 79 | fi 80 | 81 | 82 | # ======================================================== 83 | # Tear Down 84 | # ======================================================== 85 | popd 86 | -------------------------------------------------------------------------------- /ulogger/ubuffer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ubuffer.h" 3 | #include "logging_config.h" 4 | 5 | #define START_OF_EMPTY_BYTES(buffer) (buffer->capacity - buffer->num_empty_bytes_at_end) 6 | 7 | uBufferErrorCode ubuffer_init(uBuffer *ubuffer, char *start, size_t buffer_capacity) { 8 | ubuffer->start = start; 9 | ubuffer->head = 0; 10 | ubuffer->size = 0; 11 | ubuffer->capacity = buffer_capacity; 12 | ubuffer->num_empty_bytes_at_end = 0; 13 | return UBUFFER_SUCCESS; 14 | } 15 | 16 | uBufferErrorCode ubuffer_allocate_next(uBuffer *ubuffer, void **item, size_t item_size) { 17 | uBufferErrorCode err_code = UBUFFER_SUCCESS; 18 | size_t item_location; 19 | 20 | ULOGGER_ENTER_CRITICAL_SECTION(); 21 | if (ubuffer->size + item_size > ubuffer->capacity) { 22 | err_code = UBUFFER_FULL; 23 | } else { 24 | item_location = (ubuffer->head + ubuffer->size) % ubuffer->capacity; 25 | 26 | if (item_location + item_size > ubuffer->capacity) { 27 | // Add empty bytes at the end of the buffer 28 | size_t new_num_empty_bytes_at_end, new_buffer_size; 29 | new_num_empty_bytes_at_end = ubuffer->capacity - (ubuffer->head + ubuffer->size); 30 | new_buffer_size = ubuffer->size + new_num_empty_bytes_at_end; 31 | if (new_buffer_size + item_size > ubuffer->capacity) { 32 | err_code = UBUFFER_FULL; 33 | } else { 34 | ubuffer->num_empty_bytes_at_end = new_num_empty_bytes_at_end; 35 | ubuffer->size = new_buffer_size; 36 | item_location = 0; 37 | } 38 | } 39 | if (err_code == UBUFFER_SUCCESS) { 40 | ubuffer->size += item_size; 41 | *item = (void*) (ubuffer->start + item_location); 42 | } 43 | } 44 | 45 | ULOGGER_EXIT_CRITICAL_SECTION(); 46 | 47 | return err_code; 48 | } 49 | 50 | uBufferErrorCode ubuffer_free_first(uBuffer *ubuffer, void **item, size_t item_size) { 51 | uBufferErrorCode err_code = UBUFFER_SUCCESS; 52 | 53 | ULOGGER_ENTER_CRITICAL_SECTION(); 54 | 55 | err_code = ubuffer_peek_first(ubuffer, item, item_size); 56 | if (err_code == UBUFFER_SUCCESS) { 57 | ubuffer->head += item_size; 58 | ubuffer->size -= item_size; 59 | 60 | if (START_OF_EMPTY_BYTES(ubuffer) <= ubuffer->head) { 61 | ubuffer->head = 0; 62 | ubuffer->size -= ubuffer->num_empty_bytes_at_end; 63 | ubuffer->num_empty_bytes_at_end = 0; 64 | } 65 | 66 | if (ubuffer->size == 0) { 67 | ubuffer->head = 0; 68 | ubuffer->num_empty_bytes_at_end = 0; 69 | } 70 | 71 | } 72 | 73 | ULOGGER_EXIT_CRITICAL_SECTION(); 74 | return err_code; 75 | } 76 | 77 | uBufferErrorCode ubuffer_peek_first(uBuffer *ubuffer, void **item, size_t item_size) { 78 | if (item_size != 0 && (ubuffer->size < item_size || 79 | START_OF_EMPTY_BYTES(ubuffer) <= ubuffer->head + item_size - 1)) { 80 | return UBUFFER_EMPTY; 81 | } 82 | 83 | *item = (void*) (ubuffer->start + ubuffer->head); 84 | 85 | return UBUFFER_SUCCESS; 86 | } 87 | -------------------------------------------------------------------------------- /ulogger/ulogger.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief Main uLogger interface. 4 | * 5 | * @defgroup ulogger_core uLogger Core 6 | * @{ 7 | */ 8 | #ifndef ULOGGER 9 | #define ULOGGER 10 | 11 | #include 12 | #include 13 | 14 | #define PLATFORM_NRF52 0 15 | #define PLATFORM_CC3200 1 16 | 17 | /** 18 | * @mainpage Jumper Ulogger 19 | * @section Introduction 20 | * Jumper uLogger is a lightweight and extensible logging and analytics tool designed with embedded development in mind, with a tiny footprint. 21 | * @section ulogger_core_section uLogger Core 22 | * @ref ulogger_core 23 | * 24 | * @section ubuffer_section uBuffer 25 | * @ref ubuffer 26 | * 27 | * @section platforms Platforms 28 | * @subsection nrf52_section nRF52 29 | * @ref nrf52_platform 30 | */ 31 | 32 | #include "ulogger_events.h" 33 | #include "logging_config.h" 34 | 35 | /** 36 | * @brief Return codes for various ulogger methods. 37 | */ 38 | typedef enum { 39 | ULOGGER_SUCCESS = 0, 40 | ULOGGER_FAIL 41 | } uLoggerErrorCode; 42 | 43 | typedef uint8_t EventType; 44 | 45 | /** 46 | * Macro to conveniently define events with no additional data. 47 | */ 48 | #define ULOGGER_LOG(logger, level, event) ulogger_log(logger, level, event, 0, 0) 49 | 50 | /** 51 | * Send an event to the logging handlers where the event data is a null terminated string 52 | */ 53 | #define ULOGGEER_LOG_STRING(logger, level, event_type, log_string) ulogger_log(logger, level, event_type, log_string, strlen(log_string) + 1) 54 | /** 55 | * @brief Logging levels for events. 56 | */ 57 | typedef enum { 58 | ULOGGER_DEBUG = 0, 59 | ULOGGER_INFO, 60 | ULOGGER_WARNING, 61 | ULOGGER_ERROR, 62 | ULOGGER_FATAL 63 | } LogLevel; 64 | 65 | typedef enum { 66 | HANDLER_SUCCESS = 0, 67 | HANDLER_FAIL 68 | } HandlerReturnType; 69 | 70 | typedef uint32_t timestamp; 71 | 72 | typedef HandlerReturnType (*handler_func)(void *handler_data, LogLevel level, EventType event_type, timestamp time, void * log_data, size_t data_length); 73 | 74 | /** 75 | * @brief The data structure for storing the ulogger context. 76 | */ 77 | typedef struct { 78 | handler_func* handlers; 79 | void** handlers_data; 80 | size_t num_handlers; 81 | } uLogger; 82 | 83 | void get_timestamp(timestamp *data); 84 | 85 | /** 86 | * @brief Initializes the supplied uLogger structure 87 | * @param ulogger A uLogger handle 88 | * @param handlers A pointer to an array of logging handlers, handlers publish the data passed to the ulogger, in ulogger_log(). 89 | * @param handlers_data Handlers context, a handler can define a context that will be supplied when passing log data. For example 90 | * it can be useful in handlers relating to networking. 91 | * @param num_handlers 92 | * @return HANDLER_SUCCESS when successful, error code otherwise. 93 | */ 94 | uLoggerErrorCode ulogger_init(uLogger *ulogger, handler_func *handlers, void **handlers_data, size_t num_handlers); 95 | 96 | /** 97 | * @brief Send an event to the logging handlers 98 | * @param ulogger 99 | * @param level 100 | * @param event_type 101 | * @param log_data 102 | * @param data_length 103 | * @return HANDLER_SUCCESS when successful, error code otherwise. 104 | */ 105 | uLoggerErrorCode ulogger_log(uLogger *ulogger, LogLevel level, EventType event_type, void * log_data, size_t data_length); 106 | 107 | #endif // ULOGGER 108 | 109 | /** 110 | * @} 111 | */ 112 | -------------------------------------------------------------------------------- /samples/nrf52-ble-sample-project/README.md: -------------------------------------------------------------------------------- 1 | # Jumper µlogger - Nordic nRF52 Sample Project 2 | This sample project is the best way to get you started with Jumper Insights for the Nordic nRF52. 3 | 4 | ## Prerequisites 5 | - A Linux gateway 6 | - gatttool (Ubuntu: `sudo apt-get install bluez`) 7 | - pip (Ubuntu: `sudo apt install python-pip`) 8 | - libffi-dev and libssl-dev (Ubuntu: `sudo apt-get install libffi-dev libssl-dev`) 9 | 10 | - nRF52 based BLE peripheral 11 | - For compiling the project: 12 | - [nRF5 SDK v13.0.0](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF5-SDK) 13 | - [nrfjproj](http://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52832) 14 | - [jlinkARM](https://www.segger.com/downloads/jlink) 15 | 16 | ## Getting Started 17 | ### First time setup 18 | #### Gateway setup 19 | - Install Jumper's BLE Logger on your gateway: 20 | `sudo -H pip install jumper-ble-logger` 21 | - Create the following blank file on your gateway - `/etc/jumper_ble_logger/config.json` 22 | #### BLE peripheral setup 23 | - Set the following variable `export NRF52_SDK=PATH/TO/NRF5_SDK_13.0.0` on the compiling computer 24 | - Compile this project: `make` 25 | - Connect device to the computer 26 | - Flash `softdevice` to the nRF52 board: `make flash_softdevice` 27 | - Flash the project's binary to the nRF52 board: `make flash` 28 | - Reset your device 29 | #### Insights dashboard setup 30 | - Create an account on https://app-events.jumper.io/ 31 | - Create a new project 32 | #### Connect Insight project with your gateway 33 | - In Insights dashboard, under Manage Projects, find your new project and click it's settings button 34 | - Copy the token and project ID accroding to the instructions to your gateway - `/etc/jumper_ble_logger/config.json` 35 | - Note that the file should only have one `project_id` and `write_key` 36 | 37 | ### See it in Action 38 | #### BLE peripheral 39 | - Plug your nRF52 board 40 | #### Gateway 41 | - Run `hciconfig` to see the currently connected HCI devices. In this tutorial we assume you only have `hci0` at the moment. 42 | - Start the BLE Logger: `sudo service jumper-ble start` 43 | - Run `hciconfig` again to see the newly created HCI device `hci1`. We'll assume hci1 is the newly created HCI device. 44 | - Make sure when running `hciconfig` that both hci0 and hci1 are UP and RUNNING. If not run - `sudo hciconfig hciX up`.ning 45 | - Start gatttool. We will use gatttool to act as a gateway program running on your Linux device. `sudo gatttool -b -t random -i hci1 -I` 46 | - Scan for the BLE peripheral MAC address - `sudo hcitool -i hci1 lescan`. The device with JumperSampleApp name is our BLE peripheral. 47 | - Inside gatttool, connect to the BLE peripheral `connect` and discover characteristics by running `characteristics`. 48 | - At this stage the logging data will pass through to your Insights project dashboard on https://app-events.jumper.io/ . 49 | - You will notice that your gateway process (in this case gatttool) will not be notified on logging events and will work the same as it would if the BLE Logger wasn't running. 50 | #### Insights dashboard 51 | - Go to your project's dashboard on https://app-events.jumper.io/ . 52 | 53 | ### Want More? 54 | Check out our support for [nRF52](https://github.com/Jumperr-labs/jumper-ulogger/tree/master/platforms/nrf52) and the [nrf52-ble-template project](https://github.com/Jumperr-labs/jumper-ulogger/tree/master/samples/nrf52-ble-template-sdk13) to integrate this for your own project. 55 | 56 | We are happy to help! Feel free to contact us about any issue and give us your feedback at [info@jumper.io](mailto:info@jumper.io) 57 | -------------------------------------------------------------------------------- /samples/cc3200-sample/pinmux.c: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // pinmux.c 3 | // 4 | // configure the device pins for different peripheral signals 5 | // 6 | // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 13 | // Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright 17 | // notice, this list of conditions and the following disclaimer in the 18 | // documentation and/or other materials provided with the 19 | // distribution. 20 | // 21 | // Neither the name of Texas Instruments Incorporated nor the names of 22 | // its contributors may be used to endorse or promote products derived 23 | // from this software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | // 37 | //***************************************************************************** 38 | 39 | // This file was automatically generated on 7/21/2014 at 3:06:20 PM 40 | // by TI PinMux version 3.0.334 41 | // 42 | //***************************************************************************** 43 | 44 | #include "pinmux.h" 45 | #include "hw_types.h" 46 | #include "hw_memmap.h" 47 | #include "hw_gpio.h" 48 | #include "pin.h" 49 | #include "rom.h" 50 | #include "rom_map.h" 51 | #include "gpio.h" 52 | #include "prcm.h" 53 | 54 | //***************************************************************************** 55 | void 56 | PinMuxConfig(void) 57 | { 58 | // 59 | // Enable Peripheral Clocks 60 | // 61 | MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK); 62 | MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK); 63 | 64 | // 65 | // Configure PIN_55 for UART0 UART0_TX 66 | // 67 | MAP_PinTypeUART(PIN_55, PIN_MODE_3); 68 | 69 | // 70 | // Configure PIN_57 for UART0 UART0_RX 71 | // 72 | MAP_PinTypeUART(PIN_57, PIN_MODE_3); 73 | 74 | // 75 | // Configure PIN_64 for GPIOOutput 76 | // 77 | MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false); 78 | MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT); 79 | 80 | // 81 | // Configure PIN_01 for GPIOOutput 82 | // 83 | MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false); 84 | MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT); 85 | 86 | // 87 | // Configure PIN_02 for GPIOOutput 88 | // 89 | MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false); 90 | MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT); 91 | } 92 | -------------------------------------------------------------------------------- /samples/cc3200-sample/cc3200v1p32.cmd: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // cc3200v1p32.cmd 3 | // 4 | // CCS linker configuration file for cc3200 ES 1.32. 5 | // 6 | // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 13 | // Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright 17 | // notice, this list of conditions and the following disclaimer in the 18 | // documentation and/or other materials provided with the 19 | // distribution. 20 | // 21 | // Neither the name of Texas Instruments Incorporated nor the names of 22 | // its contributors may be used to endorse or promote products derived 23 | // from this software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | // 37 | //***************************************************************************** 38 | 39 | 40 | --retain=g_pfnVectors 41 | 42 | //***************************************************************************** 43 | // The following command line options are set as part of the CCS project. 44 | // If you are building using the command line, or for some reason want to 45 | // define them here, you can uncomment and modify these lines as needed. 46 | // If you are using CCS for building, it is probably better to make any such 47 | // modifications in your CCS project and leave this file alone. 48 | //***************************************************************************** 49 | 50 | 51 | //***************************************************************************** 52 | // The starting address of the application. Normally the interrupt vectors 53 | // must be located at the beginning of the application. 54 | //***************************************************************************** 55 | #define RAM_BASE 0x20004000 56 | 57 | /* System memory map */ 58 | 59 | MEMORY 60 | { 61 | /* Application uses internal RAM for program and data */ 62 | SRAM_CODE (RWX) : origin = 0x20004000, length = 0x14000 63 | SRAM_DATA (RWX) : origin = 0x20018000, length = 0x18000 64 | } 65 | 66 | /* Section allocation in memory */ 67 | 68 | SECTIONS 69 | { 70 | .intvecs: > RAM_BASE 71 | .init_array : > SRAM_CODE 72 | .vtable : > SRAM_CODE 73 | .text : > SRAM_CODE 74 | .const : > SRAM_CODE 75 | .cinit : > SRAM_CODE 76 | .pinit : > SRAM_CODE 77 | .data : > SRAM_DATA 78 | .bss : > SRAM_DATA 79 | .sysmem : > SRAM_DATA 80 | .stack : > SRAM_DATA(HIGH) 81 | } 82 | 83 | -------------------------------------------------------------------------------- /samples/cc3200-sample/ccs/cc3200v1p32.cmd: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // cc3200v1p32.cmd 3 | // 4 | // CCS linker configuration file for cc3200 ES 1.32. 5 | // 6 | // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 13 | // Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright 17 | // notice, this list of conditions and the following disclaimer in the 18 | // documentation and/or other materials provided with the 19 | // distribution. 20 | // 21 | // Neither the name of Texas Instruments Incorporated nor the names of 22 | // its contributors may be used to endorse or promote products derived 23 | // from this software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | // 37 | //***************************************************************************** 38 | 39 | 40 | --retain=g_pfnVectors 41 | 42 | //***************************************************************************** 43 | // The following command line options are set as part of the CCS project. 44 | // If you are building using the command line, or for some reason want to 45 | // define them here, you can uncomment and modify these lines as needed. 46 | // If you are using CCS for building, it is probably better to make any such 47 | // modifications in your CCS project and leave this file alone. 48 | //***************************************************************************** 49 | 50 | 51 | //***************************************************************************** 52 | // The starting address of the application. Normally the interrupt vectors 53 | // must be located at the beginning of the application. 54 | //***************************************************************************** 55 | #define RAM_BASE 0x20004000 56 | 57 | /* System memory map */ 58 | 59 | MEMORY 60 | { 61 | /* Application uses internal RAM for program and data */ 62 | SRAM_CODE (RWX) : origin = 0x20004000, length = 0x14000 63 | SRAM_DATA (RWX) : origin = 0x20018000, length = 0x18000 64 | } 65 | 66 | /* Section allocation in memory */ 67 | 68 | SECTIONS 69 | { 70 | .intvecs: > RAM_BASE 71 | .init_array : > SRAM_CODE 72 | .vtable : > SRAM_CODE 73 | .text : > SRAM_CODE 74 | .const : > SRAM_CODE 75 | .cinit : > SRAM_CODE 76 | .pinit : > SRAM_CODE 77 | .data : > SRAM_DATA 78 | .bss : > SRAM_DATA 79 | .sysmem : > SRAM_DATA 80 | .stack : > SRAM_DATA(HIGH) 81 | } 82 | 83 | -------------------------------------------------------------------------------- /platforms/nrf52/README.md: -------------------------------------------------------------------------------- 1 | # nRF52 Readme 2 | Follow these instructions to integrate Jumper Insights to an nRF52 project. Note how small the footprint is? We also made sure the bandwidth and energy requirements are minimal. 3 | 4 | The nRF52 is using GATT protocol to send events to a Linux gateway over BLE. 5 | The gateway should have the BLE Logger running. Check it [this repo](https://github.com/Jumperr-labs/jumper-ble-logger) 6 | 7 | ## Getting Started 8 | Check out this [tutorial](https://github.com/Jumperr-labs/jumper-ulogger/tree/master/samples/nrf52-ble-sample-project) to get started with a sample project for the nRF52. 9 | 10 | You can also use this [template project](https://github.com/Jumperr-labs/jumper-ulogger/tree/master/samples/nrf52-ble-template-sdk13) to embed jumper's µlogger in your own code. 11 | 12 | ## How It Works 13 | When a logging event occures it is being saved to a buffer. Using an RTC handle, every given time interval the logged events will be sent over BLE to the gateway. 14 | 15 | ## Adding the µlogger to Your nRF52 Project 16 | ### Relevant code files 17 | Add the following files and include paths to your code: 18 | ``` 19 | Repository Root 20 | ├── README.md 21 | ├── platforms 22 | │   └── nrf52 23 | │   ├── README.md 24 | │   ├── gatt_handler.c 25 | │   ├── gatt_handler.h 26 | │   ├── trace_nrf52.c 27 | │   ├── trace_nrf52.h 28 | │   ├── ulogger_nrf52.c 29 | │   └── ulogger_nrf52.h 30 | └── ulogger 31 | ├── handlers 32 | │   ├── network_log_handler.c 33 | │   └── network_log_handler.h 34 | ├── ubuffer.c 35 | ├── ubuffer.h 36 | ├── ulogger.c 37 | └── ulogger.h 38 | ``` 39 | 40 | ### Changes to main.c 41 | * Include the µLogger `#include "ulogger_nrf52.h` 42 | * Inside `static void ble_stack_init(void)`, increase the UUID count by 1 as we’re adding a vendor specific GATT service. In Nordic’s example it was set to 0, so we’re increasing to 1. 43 | 44 | `ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = 1;` 45 | * We need to receive BLE events from the SoftDevice, to do so add the following line to `static void ble_evt_dispatch(ble_evt_t * p_ble_evt)`: 46 | 47 | `ulogger_handle_ble_event(p_ble_evt);` 48 | 49 | ### Linking 50 | 51 | #### ARMGCC 52 | Moving on to the *.ld file, in our case `ble_app_template_gcc_nrf52.ld`: 53 | 54 | From the `Memory.RAM` section, push the origin 0x10 bytes forward and reduce the length by 0x10 bytes. Based on the original example, this means changing this line: 55 | ``` 56 | RAM (rwx) : ORIGIN = 0x20001fc0, LENGTH = 0xe040 57 | ``` 58 | To this: 59 | ``` 60 | RAM (rwx) : ORIGIN = 0x20001fd0, LENGTH = 0xe030 61 | ``` 62 | #### IAR 63 | In your *.icf file (here we used `ble_app_template_iar_nRF5x.icf`, change RAM start by 0x10 bytes, from: 64 | ``` 65 | define symbol __ICFEDIT_region_RAM_start__ = 0x20001fc0; 66 | ``` 67 | To this: 68 | ``` 69 | define symbol __ICFEDIT_region_RAM_start__ = 0x20001fd0; 70 | ``` 71 | ### Initialization 72 | * On the `main(void)` function, add the following line when initializing services `ulogger_init_nrf52(&ulogger);` 73 | 74 | *Note - this has to happen after the SoftDevice is configured and BLE is initialized.* 75 | 76 | ### Tracing 77 | To trace advertising events add the following line to the beginning of the `on_adv_evt` function: 78 | 79 | `ulogger_trace_nrf_ble_adv_event(ble_adv_evt);` 80 | 81 | ### Configuration 82 | Create a copy of _"logging_config.h"_ and add it to your project. Currently there are two configuration options. 83 | 84 | You can edit either of these options, depending on the number of log events you intend to add per second or your power budget. 85 | 86 | The configuration option are: 87 | * `GATT_BUFFER_SIZE` - Buffer size in bytes, currently defaults to 200. 88 | * `LOG_SEND_PERIOD_MS` - Period between sending the logging buffer to the gateway, currently defaults to 5000 ms. 89 | -------------------------------------------------------------------------------- /platforms/cc3200/README.md: -------------------------------------------------------------------------------- 1 | # CC3200 Platform Readme 2 | 3 | In the CC3200 platform, since we're using wifi, we have to directly interact with jumper's API, this client implements an HTTP client that interacts securely with our service. 4 | 5 | ## Getting started 6 | 7 | You can check out [this](TBD) tutorial to quickly get started. 8 | 9 | ## How it works 10 | 11 | All logged events are saved into the buffer as they are generated by your code, every pre-defined interval the buffer is flushed and all events are formatted and sent to the server. 12 | 13 | # Adding the CC3200 µlogger to your project 14 | 15 | ## Relevant files 16 | Add all the files in the _ulogger_ directory, _ulogger/handlers_ and _platforms/cc3200_. 17 | ``` 18 | Repository Root 19 | ├── README.md 20 | ├── platforms 21 | │   ├── cc3200 22 | │   │   ├── README.md 23 | │   │   ├── events_api_handler.c 24 | │   │   ├── events_api_handler.h 25 | │   │   ├── json_encoding_helper.h 26 | │   │   ├── json_formatter.c 27 | │   │   ├── json_formatter.h 28 | │   │   ├── logging_config.h 29 | │   │   ├── ulogger_cc3200.c 30 | │   │   └── ulogger_cc3200.h 31 | │   └── nrf52 32 | ├── samples 33 | │   ├── cc3200-sample 34 | │   └── nrf52-ble 35 | └── ulogger 36 | ├── handlers 37 | │   ├── network_log_handler.c 38 | │   └── network_log_handler.h 39 | ├── ubuffer.c 40 | ├── ubuffer.h 41 | ├── ulogger.c 42 | ├── ulogger.h 43 | └── ulogger_events.h 44 | ``` 45 | ## Changes to main.c 46 | 47 | * Define a logger struct - `uLogger logger` 48 | * We use the status unsigned long that TI use in their samples to determine the connection state - `g_ulStatus`, make sure that you have it and keep it synced with the state of the device. 49 | You can also override this method, more info in the documentation. 50 | * Initialize the ulogger with the logger struct `ulogger_init_cc3200(&logger)` 51 | 52 | ## Configuration 53 | 54 | In `logging_config.h` you have the following configurations avilable: 55 | 56 | ``` 57 | #define JUMPER_PROJECT_ID "000000000000000000000000" 58 | #define JUMPER_WRITE_KEY "000000000000000000000000" 59 | 60 | #define API_HANDLER_LOG_SEND_PERIOD 5000 61 | #define API_HANDLER_BUFFER_SIZE 300 62 | #define API_HANDLE_JSON_ENCODER_BUFFER_SIZE 200 63 | ``` 64 | 65 | * You must replace `JUMPER_PROJECT_ID` and `JUMPER_WRITE_KEY` with the keys you get from the jumper control panel. 66 | * The definitions `API_HANDLER_LOG_SEND_PERIOD` and `API_HANDLER_BUFFER_SIZE` control the buffer size and flush interval 67 | of the buffer that accumulates logging events, change those if you want to increase the interval or buffer size depending on the number of log events you intend to add per second or your power budget. 68 | * `API_HANDLE_JSON_ENCODER_BUFFER_SIZE` defines the buffer size of the encoder that encodes events into JSON format, it must be large enough to fit the largest event, in JSON format. 69 | 70 | ## JSON formatter 71 | 72 | In the CC3200 platform directory you will find `json_formatter.c`, in the method `json_formatter_format` you must implement a case for each of your user defined events. We implemented several examples with helper 73 | methods to easily generate a json object from your event data. 74 | 75 | For example, in this method we're packing a wlan event (which is generated when the device is connected to a wifi network), and pack its fields consisting of an integer and a null terminated string: 76 | ``` 77 | case WLAN_EVENT: 78 | { 79 | wlan_event_t * event_metadata = (wlan_event_t *) additional_data; 80 | PACK_EVENT_TYPE(buf, WLAN_EVENT); 81 | PACK_NAME_AND_INT(buf, event_metadata, is_connected); 82 | PACK_NAME_AND_STRING(buf, event_metadata, bssid); 83 | } 84 | ``` 85 | For more information about the helper methods and the formatter check out the documentation. 86 | 87 | ## Helper Library 88 | 1. You'll also be using a modified version of the keen.io cc3200 client as a helper library. 89 | 2. Check out the repo [here](https://github.com/Jumperr-labs/keen-cc3200) and compile it as a library. 90 | 3. Define the library as a dependency in Code Composer Studio. -------------------------------------------------------------------------------- /samples/cc3200-sample/common.h: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // common.h 3 | // 4 | // Contains the common macro/enum definitions used by different networking apps 5 | // 6 | // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 13 | // Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 16 | // Redistributions in binary form must reproduce the above copyright 17 | // notice, this list of conditions and the following disclaimer in the 18 | // documentation and/or other materials provided with the 19 | // distribution. 20 | // 21 | // Neither the name of Texas Instruments Incorporated nor the names of 22 | // its contributors may be used to endorse or promote products derived 23 | // from this software without specific prior written permission. 24 | // 25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | // 37 | //***************************************************************************** 38 | 39 | #ifndef __COMMON__H__ 40 | #define __COMMON__H__ 41 | 42 | 43 | //***************************************************************************** 44 | // 45 | // If building with a C++ compiler, make all of the definitions in this header 46 | // have a C binding. 47 | // 48 | //***************************************************************************** 49 | 50 | #ifdef __cplusplus 51 | extern "C" 52 | { 53 | #endif 54 | 55 | 56 | // 57 | // Values for below macros shall be modified as per access-point(AP) properties 58 | // SimpleLink device will connect to following AP when application is executed 59 | // 60 | #define SSID_NAME "YOUR_SSID" /* AP SSID */ 61 | #define SECURITY_TYPE SL_SEC_TYPE_WPA_WPA2/* Security type (OPEN or WEP or WPA*/ 62 | #define SECURITY_KEY "YOUR_KEY" /* Password of the secured AP */ 63 | #define SSID_LEN_MAX 32 64 | #define BSSID_LEN_MAX 6 65 | 66 | 67 | #ifdef NOTERM 68 | #define UART_PRINT(x,...) 69 | #define DBG_PRINT(x,...) 70 | #define ERR_PRINT(x) 71 | #else 72 | #define UART_PRINT Report 73 | #define DBG_PRINT Report 74 | #define ERR_PRINT(x) Report("Error [%d] at line [%d] in function [%s] \n\r",x,__LINE__,__FUNCTION__) 75 | #endif 76 | 77 | // Loop forever, user can change it as per application's requirement 78 | #define LOOP_FOREVER() \ 79 | {\ 80 | while(1); \ 81 | } 82 | 83 | // check the error code and handle it 84 | #define ASSERT_ON_ERROR(error_code)\ 85 | {\ 86 | if(error_code < 0) \ 87 | {\ 88 | ERR_PRINT(error_code);\ 89 | return error_code;\ 90 | }\ 91 | } 92 | 93 | #define SPAWN_TASK_PRIORITY 9 94 | #define SL_STOP_TIMEOUT 200 95 | #define UNUSED(x) ((x) = (x)) 96 | #define SUCCESS 0 97 | #define FAILURE -1 98 | 99 | 100 | // Status bits - These are used to set/reset the corresponding bits in 101 | // given variable 102 | typedef enum{ 103 | STATUS_BIT_NWP_INIT = 0, // If this bit is set: Network Processor is 104 | // powered up 105 | 106 | STATUS_BIT_CONNECTION, // If this bit is set: the device is connected to 107 | // the AP or client is connected to device (AP) 108 | 109 | STATUS_BIT_IP_LEASED, // If this bit is set: the device has leased IP to 110 | // any connected client 111 | 112 | STATUS_BIT_IP_AQUIRED, // If this bit is set: the device has acquired an IP 113 | 114 | STATUS_BIT_SMARTCONFIG_START, // If this bit is set: the SmartConfiguration 115 | // process is started from SmartConfig app 116 | 117 | STATUS_BIT_P2P_DEV_FOUND, // If this bit is set: the device (P2P mode) 118 | // found any p2p-device in scan 119 | 120 | STATUS_BIT_P2P_REQ_RECEIVED, // If this bit is set: the device (P2P mode) 121 | // found any p2p-negotiation request 122 | 123 | STATUS_BIT_CONNECTION_FAILED, // If this bit is set: the device(P2P mode) 124 | // connection to client(or reverse way) is failed 125 | 126 | STATUS_BIT_PING_DONE // If this bit is set: the device has completed 127 | // the ping operation 128 | 129 | }e_StatusBits; 130 | 131 | 132 | #define CLR_STATUS_BIT_ALL(status_variable) (status_variable = 0) 133 | #define SET_STATUS_BIT(status_variable, bit) status_variable |= (1<<(bit)) 134 | #define CLR_STATUS_BIT(status_variable, bit) status_variable &= ~(1<<(bit)) 135 | #define CLR_STATUS_BIT_ALL(status_variable) (status_variable = 0) 136 | #define GET_STATUS_BIT(status_variable, bit) (0 != (status_variable & (1<<(bit)))) 137 | 138 | #define IS_NW_PROCSR_ON(status_variable) GET_STATUS_BIT(status_variable,\ 139 | STATUS_BIT_NWP_INIT) 140 | #define IS_CONNECTED(status_variable) GET_STATUS_BIT(status_variable,\ 141 | STATUS_BIT_CONNECTION) 142 | #define IS_IP_LEASED(status_variable) GET_STATUS_BIT(status_variable,\ 143 | STATUS_BIT_IP_LEASED) 144 | #define IS_IP_ACQUIRED(status_variable) GET_STATUS_BIT(status_variable,\ 145 | STATUS_BIT_IP_AQUIRED) 146 | #define IS_SMART_CFG_START(status_variable) GET_STATUS_BIT(status_variable,\ 147 | STATUS_BIT_SMARTCONFIG_START) 148 | #define IS_P2P_DEV_FOUND(status_variable) GET_STATUS_BIT(status_variable,\ 149 | STATUS_BIT_P2P_DEV_FOUND) 150 | #define IS_P2P_REQ_RCVD(status_variable) GET_STATUS_BIT(status_variable,\ 151 | STATUS_BIT_P2P_REQ_RECEIVED) 152 | #define IS_CONNECT_FAILED(status_variable) GET_STATUS_BIT(status_variable,\ 153 | STATUS_BIT_CONNECTION_FAILED) 154 | #define IS_PING_DONE(status_variable) GET_STATUS_BIT(status_variable,\ 155 | STATUS_BIT_PING_DONE) 156 | 157 | //***************************************************************************** 158 | // 159 | // Mark the end of the C bindings section for C++ compilers. 160 | // 161 | //***************************************************************************** 162 | #ifdef __cplusplus 163 | } 164 | #endif 165 | #endif //__COMMON__H__ 166 | 167 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10028/s130/arm5_no_packs/ble_app_template_pca10028_s130.uvoptx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | nrf51422_xxac 9 | 0x4 10 | ARM-ADS 11 | 12 | 13 | 1 14 | 1 15 | 0 16 | 1 17 | 18 | 19 | 1 20 | 65535 21 | 0 22 | 0 23 | 0 24 | 25 | 26 | 79 27 | 66 28 | 8 29 | .\_build\ 30 | 31 | 0 32 | 33 | 0 34 | 1 35 | 1 36 | 1 37 | 1 38 | 1 39 | 1 40 | 1 41 | 1 42 | 1 43 | 1 44 | 1 45 | 1 46 | 1 47 | 0 48 | 1 49 | 0 50 | 1 51 | 1 52 | 1 53 | 0 54 | 0 55 | 7 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Segger\JL2CM3.dll 67 | 68 | 69 | 70 | 0 71 | JL2CM3 72 | -U408001579 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf51xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF51422_xxAC$Flash\nrf51xxx.flm) 73 | 74 | 75 | 0 76 | UL2CM3 77 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51422_xxAC$Flash\nrf51xxx)) 78 | 79 | 80 | 81 | 82 | 0 83 | 84 | 85 | 0 86 | 0 87 | 0 88 | 0 89 | 0 90 | 0 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 0 103 | 0 104 | 0 105 | 0 106 | 0 107 | 0 108 | 0 109 | 110 | 111 | 112 | 113 | 114 | flash_s130_nrf51_2.0.1_softdevice 115 | 0x4 116 | ARM-ADS 117 | 118 | 119 | 1 120 | 1 121 | 0 122 | 1 123 | 124 | 125 | 1 126 | 65535 127 | 0 128 | 0 129 | 0 130 | 131 | 132 | 79 133 | 66 134 | 8 135 | .\_build\ 136 | 137 | 0 138 | 139 | 0 140 | 1 141 | 1 142 | 1 143 | 1 144 | 1 145 | 1 146 | 1 147 | 1 148 | 1 149 | 1 150 | 1 151 | 1 152 | 1 153 | 0 154 | 1 155 | 0 156 | 1 157 | 1 158 | 1 159 | 0 160 | 0 161 | 7 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | Segger\JL2CM3.dll 173 | 174 | 175 | 176 | 0 177 | JL2CM3 178 | -U408001579 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN1 -FF0nrf51xxx_ecb.flm -FS00 -FL0200000 -FP0($$Device:nRF51422_xxAC$Flash\nrf51xxx_ecb.flm) 179 | 180 | 181 | 0 182 | UL2CM3 183 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51422_xxAC$Flash\nrf51xxx)) 184 | 185 | 186 | 187 | 188 | 0 189 | 190 | 191 | 0 192 | 0 193 | 0 194 | 0 195 | 0 196 | 0 197 | 0 198 | 0 199 | 0 200 | 0 201 | 0 202 | 0 203 | 0 204 | 0 205 | 0 206 | 0 207 | 0 208 | 0 209 | 0 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 216 | 217 | 218 | 219 |
220 | 221 | 222 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10040/s132/arm5_no_packs/ble_app_template_pca10040_s132.uvoptx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | nrf52832_xxaa 9 | 0x4 10 | ARM-ADS 11 | 12 | 13 | 1 14 | 1 15 | 0 16 | 1 17 | 18 | 19 | 1 20 | 65535 21 | 0 22 | 0 23 | 0 24 | 25 | 26 | 79 27 | 66 28 | 8 29 | .\_build\ 30 | 31 | 0 32 | 33 | 0 34 | 1 35 | 1 36 | 1 37 | 1 38 | 1 39 | 1 40 | 1 41 | 1 42 | 1 43 | 1 44 | 1 45 | 1 46 | 1 47 | 0 48 | 1 49 | 0 50 | 1 51 | 1 52 | 1 53 | 0 54 | 0 55 | 7 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Segger\JL2CM3.dll 67 | 68 | 69 | 70 | 0 71 | JL2CM3 72 | -U408001579 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52832_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr -FS110001000 -FL11000 -FP1($$Device:nRF52832_xxAA$Flash\nrf52xxx_uicr.flm) 73 | 74 | 75 | 0 76 | UL2CM3 77 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000 -FP0($$Device:nRF52832_xxAA$Flash\nrf52xxx)) 78 | 79 | 80 | 81 | 82 | 0 83 | 84 | 85 | 0 86 | 0 87 | 0 88 | 0 89 | 0 90 | 0 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 0 103 | 0 104 | 0 105 | 0 106 | 0 107 | 0 108 | 0 109 | 110 | 111 | 112 | 113 | 114 | flash_s132_nrf52_3.0.0_softdevice 115 | 0x4 116 | ARM-ADS 117 | 118 | 119 | 1 120 | 1 121 | 0 122 | 1 123 | 124 | 125 | 1 126 | 65535 127 | 0 128 | 0 129 | 0 130 | 131 | 132 | 79 133 | 66 134 | 8 135 | .\_build\ 136 | 137 | 0 138 | 139 | 0 140 | 1 141 | 1 142 | 1 143 | 1 144 | 1 145 | 1 146 | 1 147 | 1 148 | 1 149 | 1 150 | 1 151 | 1 152 | 1 153 | 0 154 | 1 155 | 0 156 | 1 157 | 1 158 | 1 159 | 0 160 | 0 161 | 7 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | Segger\JL2CM3.dll 173 | 174 | 175 | 176 | 0 177 | JL2CM3 178 | -U408001579 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52832_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr -FS110001000 -FL11000 -FP1($$Device:nRF52832_xxAA$Flash\nrf52xxx_uicr.flm) 179 | 180 | 181 | 0 182 | UL2CM3 183 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000 -FP0($$Device:nRF52832_xxAA$Flash\nrf52xxx)) 184 | 185 | 186 | 187 | 188 | 0 189 | 190 | 191 | 0 192 | 0 193 | 0 194 | 0 195 | 0 196 | 0 197 | 0 198 | 0 199 | 0 200 | 0 201 | 0 202 | 0 203 | 0 204 | 0 205 | 0 206 | 0 207 | 0 208 | 0 209 | 0 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 216 | 217 | 218 | 219 |
220 | 221 | 222 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10056/s132/arm5_no_packs/ble_app_template_pca10056_s132.uvoptx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | nrf52840_xxaa 9 | 0x4 10 | ARM-ADS 11 | 12 | 13 | 1 14 | 1 15 | 0 16 | 1 17 | 18 | 19 | 1 20 | 65535 21 | 0 22 | 0 23 | 0 24 | 25 | 26 | 79 27 | 66 28 | 8 29 | .\_build\ 30 | 31 | 0 32 | 33 | 0 34 | 1 35 | 1 36 | 1 37 | 1 38 | 1 39 | 1 40 | 1 41 | 1 42 | 1 43 | 1 44 | 1 45 | 1 46 | 1 47 | 0 48 | 1 49 | 0 50 | 1 51 | 1 52 | 1 53 | 0 54 | 0 55 | 7 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Segger\JL2CM3.dll 67 | 68 | 69 | 70 | 0 71 | JL2CM3 72 | -U408001579 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr -FS110001000 -FL11000 -FP1($$Device:nRF52840_xxAA$Flash\nrf52xxx_uicr.flm) 73 | 74 | 75 | 0 76 | UL2CM3 77 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx)) 78 | 79 | 80 | 81 | 82 | 0 83 | 84 | 85 | 0 86 | 0 87 | 0 88 | 0 89 | 0 90 | 0 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 0 103 | 0 104 | 0 105 | 0 106 | 0 107 | 0 108 | 0 109 | 110 | 111 | 112 | 113 | 114 | flash_s132_nrf52_3.0.0_softdevice 115 | 0x4 116 | ARM-ADS 117 | 118 | 119 | 1 120 | 1 121 | 0 122 | 1 123 | 124 | 125 | 1 126 | 65535 127 | 0 128 | 0 129 | 0 130 | 131 | 132 | 79 133 | 66 134 | 8 135 | .\_build\ 136 | 137 | 0 138 | 139 | 0 140 | 1 141 | 1 142 | 1 143 | 1 144 | 1 145 | 1 146 | 1 147 | 1 148 | 1 149 | 1 150 | 1 151 | 1 152 | 1 153 | 0 154 | 1 155 | 0 156 | 1 157 | 1 158 | 1 159 | 0 160 | 0 161 | 7 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | Segger\JL2CM3.dll 173 | 174 | 175 | 176 | 0 177 | JL2CM3 178 | -U408001579 -O78 -S0 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC2000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr -FS110001000 -FL11000 -FP1($$Device:nRF52840_xxAA$Flash\nrf52xxx_uicr.flm) 179 | 180 | 181 | 0 182 | UL2CM3 183 | UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0nrf52xxx -FS00 -FL0200000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx)) 184 | 185 | 186 | 187 | 188 | 0 189 | 190 | 191 | 0 192 | 0 193 | 0 194 | 0 195 | 0 196 | 0 197 | 0 198 | 0 199 | 0 200 | 0 201 | 0 202 | 0 203 | 0 204 | 0 205 | 0 206 | 0 207 | 0 208 | 0 209 | 0 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 216 | 217 | 218 | 219 |
220 | 221 | 222 | -------------------------------------------------------------------------------- /doxygen-bootstrapped/customdoxygen.css: -------------------------------------------------------------------------------- 1 | h1, .h1, h2, .h2, h3, .h3{ 2 | font-weight: 200 !important; 3 | } 4 | 5 | #navrow1, #navrow2, #navrow3, #navrow4, #navrow5{ 6 | border-bottom: 1px solid #EEEEEE; 7 | } 8 | 9 | .adjust-right { 10 | margin-left: 30px !important; 11 | font-size: 1.15em !important; 12 | } 13 | .navbar{ 14 | border: 0px solid #222 !important; 15 | } 16 | table{ 17 | white-space:pre-wrap !important; 18 | } 19 | /* 20 | =========================== 21 | */ 22 | 23 | 24 | /* Sticky footer styles 25 | -------------------------------------------------- */ 26 | html, 27 | body { 28 | height: 100%; 29 | /* The html and body elements cannot have any padding or margin. */ 30 | } 31 | 32 | /* Wrapper for page content to push down footer */ 33 | #wrap { 34 | min-height: 100%; 35 | height: auto; 36 | /* Negative indent footer by its height */ 37 | margin: 0 auto -60px; 38 | /* Pad bottom by footer height */ 39 | padding: 0 0 60px; 40 | } 41 | 42 | /* Set the fixed height of the footer here */ 43 | #footer { 44 | font-size: 0.9em; 45 | padding: 8px 0px; 46 | background-color: #f5f5f5; 47 | } 48 | 49 | .footer-row { 50 | line-height: 44px; 51 | } 52 | 53 | #footer > .container { 54 | padding-left: 15px; 55 | padding-right: 15px; 56 | } 57 | 58 | .footer-follow-icon { 59 | margin-left: 3px; 60 | text-decoration: none !important; 61 | } 62 | 63 | .footer-follow-icon img { 64 | width: 20px; 65 | } 66 | 67 | .footer-link { 68 | padding-top: 5px; 69 | display: inline-block; 70 | color: #999999; 71 | text-decoration: none; 72 | } 73 | 74 | .footer-copyright { 75 | text-align: center; 76 | } 77 | 78 | 79 | @media (min-width: 992px) { 80 | .footer-row { 81 | text-align: left; 82 | } 83 | 84 | .footer-icons { 85 | text-align: right; 86 | } 87 | } 88 | @media (max-width: 991px) { 89 | .footer-row { 90 | text-align: center; 91 | } 92 | 93 | .footer-icons { 94 | text-align: center; 95 | } 96 | } 97 | 98 | /* DOXYGEN Code Styles 99 | ----------------------------------- */ 100 | 101 | 102 | a.qindex { 103 | font-weight: bold; 104 | } 105 | 106 | a.qindexHL { 107 | font-weight: bold; 108 | background-color: #9CAFD4; 109 | color: #ffffff; 110 | border: 1px double #869DCA; 111 | } 112 | 113 | .contents a.qindexHL:visited { 114 | color: #ffffff; 115 | } 116 | 117 | a.code, a.code:visited, a.line, a.line:visited { 118 | color: #4665A2; 119 | } 120 | 121 | a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { 122 | color: #4665A2; 123 | } 124 | 125 | /* @end */ 126 | 127 | dl.el { 128 | margin-left: -1cm; 129 | } 130 | 131 | pre.fragment { 132 | border: 1px solid #C4CFE5; 133 | background-color: #FBFCFD; 134 | padding: 4px 6px; 135 | margin: 4px 8px 4px 2px; 136 | overflow: auto; 137 | word-wrap: break-word; 138 | font-size: 9pt; 139 | line-height: 125%; 140 | font-family: monospace, fixed; 141 | font-size: 105%; 142 | } 143 | 144 | div.fragment { 145 | padding: 4px 6px; 146 | margin: 4px 8px 4px 2px; 147 | border: 1px solid #C4CFE5; 148 | } 149 | 150 | div.line { 151 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 152 | font-size: 12px; 153 | min-height: 13px; 154 | line-height: 1.0; 155 | text-wrap: unrestricted; 156 | white-space: -moz-pre-wrap; /* Moz */ 157 | white-space: -pre-wrap; /* Opera 4-6 */ 158 | white-space: -o-pre-wrap; /* Opera 7 */ 159 | white-space: pre-wrap; /* CSS3 */ 160 | word-wrap: normal; /* IE 5.5+ */ 161 | text-indent: -53px; 162 | padding-left: 53px; 163 | padding-bottom: 0px; 164 | margin: 0px; 165 | -webkit-transition-property: background-color, box-shadow; 166 | -webkit-transition-duration: 0.5s; 167 | -moz-transition-property: background-color, box-shadow; 168 | -moz-transition-duration: 0.5s; 169 | -ms-transition-property: background-color, box-shadow; 170 | -ms-transition-duration: 0.5s; 171 | -o-transition-property: background-color, box-shadow; 172 | -o-transition-duration: 0.5s; 173 | transition-property: background-color, box-shadow; 174 | transition-duration: 0.5s; 175 | } 176 | div.line:hover{ 177 | background-color: #FBFF00; 178 | } 179 | 180 | div.line.glow { 181 | background-color: cyan; 182 | box-shadow: 0 0 10px cyan; 183 | } 184 | 185 | 186 | span.lineno { 187 | padding-right: 4px; 188 | text-align: right; 189 | color:rgba(0,0,0,0.3); 190 | border-right: 1px solid #EEE; 191 | border-left: 1px solid #EEE; 192 | background-color: #FFF; 193 | white-space: pre; 194 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace ; 195 | } 196 | span.lineno a { 197 | background-color: #FAFAFA; 198 | cursor:pointer; 199 | } 200 | 201 | span.lineno a:hover { 202 | background-color: #EFE200; 203 | color: #1e1e1e; 204 | } 205 | 206 | div.groupHeader { 207 | margin-left: 16px; 208 | margin-top: 12px; 209 | font-weight: bold; 210 | } 211 | 212 | div.groupText { 213 | margin-left: 16px; 214 | font-style: italic; 215 | } 216 | 217 | /* @group Code Colorization */ 218 | 219 | span.keyword { 220 | color: #008000 221 | } 222 | 223 | span.keywordtype { 224 | color: #604020 225 | } 226 | 227 | span.keywordflow { 228 | color: #e08000 229 | } 230 | 231 | span.comment { 232 | color: #800000 233 | } 234 | 235 | span.preprocessor { 236 | color: #806020 237 | } 238 | 239 | span.stringliteral { 240 | color: #002080 241 | } 242 | 243 | span.charliteral { 244 | color: #008080 245 | } 246 | 247 | span.vhdldigit { 248 | color: #ff00ff 249 | } 250 | 251 | span.vhdlchar { 252 | color: #000000 253 | } 254 | 255 | span.vhdlkeyword { 256 | color: #700070 257 | } 258 | 259 | span.vhdllogic { 260 | color: #ff0000 261 | } 262 | 263 | blockquote { 264 | background-color: #F7F8FB; 265 | border-left: 2px solid #9CAFD4; 266 | margin: 0 24px 0 4px; 267 | padding: 0 12px 0 16px; 268 | } 269 | 270 | /*---------------- Search Box */ 271 | 272 | #search-box { 273 | margin: 10px 0px; 274 | } 275 | #search-box .close { 276 | display: none; 277 | position: absolute; 278 | right: 0px; 279 | padding: 6px 12px; 280 | z-index: 5; 281 | } 282 | 283 | /*---------------- Search results window */ 284 | 285 | #search-results-window { 286 | display: none; 287 | } 288 | 289 | iframe#MSearchResults { 290 | width: 100%; 291 | height: 15em; 292 | } 293 | 294 | .SRChildren { 295 | padding-left: 3ex; padding-bottom: .5em 296 | } 297 | .SRPage .SRChildren { 298 | display: none; 299 | } 300 | a.SRScope { 301 | display: block; 302 | } 303 | a.SRSymbol:focus, a.SRSymbol:active, 304 | a.SRScope:focus, a.SRScope:active { 305 | text-decoration: underline; 306 | } 307 | span.SRScope { 308 | padding-left: 4px; 309 | } 310 | .SRResult { 311 | display: none; 312 | } 313 | 314 | /* class and file list */ 315 | .directory .icona, 316 | .directory .arrow { 317 | height: auto; 318 | } 319 | .directory .icona .icon { 320 | height: 16px; 321 | } 322 | .directory .icondoc { 323 | background-position: 0px 0px; 324 | height: 20px; 325 | } 326 | .directory .iconfopen { 327 | background-position: 0px 0px; 328 | } 329 | .directory td.entry { 330 | padding: 7px 8px 6px 8px; 331 | } 332 | 333 | .table > tbody > tr > td.memSeparator { 334 | line-height: 0; 335 | .table-hover; 336 | 337 | } 338 | 339 | .memItemLeft, .memTemplItemLeft { 340 | white-space: normal; 341 | } 342 | 343 | /* enumerations */ 344 | .panel-body thead > tr { 345 | background-color: #e0e0e0; 346 | } 347 | 348 | /* todo lists */ 349 | .todoname, 350 | .todoname a { 351 | font-weight: bold; 352 | } 353 | 354 | /* Class title */ 355 | .summary { 356 | margin-top: 25px; 357 | } 358 | .page-header { 359 | margin: 20px 0px !important; 360 | } 361 | .page-header .title { 362 | display: inline-block; 363 | } 364 | .page-header .pull-right { 365 | margin-top: 0.3em; 366 | margin-left: 0.5em; 367 | } 368 | .page-header .label { 369 | font-size: 50%; 370 | } 371 | -------------------------------------------------------------------------------- /test/test_module/test_ubuffer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "unity.h" 4 | #include "unity_fixture.h" 5 | #include "mock_critical_section.h" 6 | #include 7 | 8 | #define BUFFER_CAPACITY 15 9 | #define MAX_INT_TYPE_IN_BUFFER (BUFFER_CAPACITY / sizeof(int)) 10 | TEST_GROUP(TestUbuffer); 11 | 12 | static uBuffer ubuffer; 13 | static char *buffer_memory; 14 | static uBuffer ubuffer_clone; 15 | static char *data_clone[BUFFER_CAPACITY]; 16 | 17 | void clone_buffer() { 18 | memcpy((char*) &ubuffer_clone, (char*) &ubuffer, sizeof(uBuffer)); 19 | memcpy((char*) data_clone, buffer_memory, BUFFER_CAPACITY); 20 | } 21 | 22 | void assert_buffer_equal_clone() { 23 | TEST_ASSERT_EQUAL_MEMORY(&ubuffer_clone, &ubuffer, sizeof(uBuffer)); 24 | TEST_ASSERT_EQUAL_MEMORY(data_clone, buffer_memory, BUFFER_CAPACITY); 25 | } 26 | 27 | void fill_buffer() { 28 | int *item; 29 | for (int i = 0; i < MAX_INT_TYPE_IN_BUFFER; i++) { 30 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 31 | TEST_ASSERT_EQUAL((int *) buffer_memory + i, item); 32 | TEST_ASSERT_EQUAL((i + 1) * sizeof(int), ubuffer.size); 33 | *item = i; 34 | }; 35 | 36 | TEST_ASSERT_EQUAL(UBUFFER_FULL, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 37 | TEST_ASSERT_EQUAL(MAX_INT_TYPE_IN_BUFFER * sizeof(int), ubuffer.size); 38 | } 39 | 40 | void empty_a_full_buffer(int first_value_in_buffer) { 41 | int *item; 42 | 43 | // Pop everything out 44 | for (int i = 0; i < MAX_INT_TYPE_IN_BUFFER; i++) { 45 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 46 | TEST_ASSERT_EQUAL(i + first_value_in_buffer, *item); 47 | } 48 | 49 | // Try to pop an item when the buffer is empty 50 | TEST_ASSERT_EQUAL(UBUFFER_EMPTY, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 51 | TEST_ASSERT_EQUAL(0, ubuffer.size); 52 | } 53 | 54 | TEST_SETUP(TestUbuffer) { 55 | buffer_memory = (char*) malloc(BUFFER_CAPACITY); 56 | ubuffer_init(&ubuffer, buffer_memory, BUFFER_CAPACITY); 57 | } 58 | 59 | TEST_TEAR_DOWN(TestUbuffer) { 60 | free(buffer_memory); 61 | } 62 | 63 | TEST(TestUbuffer, Test_Init) { 64 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY, ubuffer.capacity); 65 | TEST_ASSERT_EQUAL(buffer_memory, ubuffer.start); 66 | TEST_ASSERT_EQUAL(0, ubuffer.head); 67 | TEST_ASSERT_EQUAL(0, ubuffer.size); 68 | TEST_ASSERT_EQUAL(0, ubuffer.num_empty_bytes_at_end); 69 | TEST_ASSERT_EQUAL(0, mock_critical_section_state()); 70 | } 71 | 72 | TEST(TestUbuffer, Test_Allocate) { 73 | int *item; 74 | ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int)); 75 | *item = 10; 76 | TEST_ASSERT_EQUAL(ubuffer.start, item); 77 | TEST_ASSERT_EQUAL(sizeof(int), ubuffer.size); 78 | TEST_ASSERT_EQUAL(0, mock_critical_section_state()); 79 | TEST_ASSERT_EQUAL(1, mock_critical_section_calls()); 80 | } 81 | 82 | TEST(TestUbuffer, Test_Free) { 83 | int *item_pushed, *item_poped; 84 | ubuffer_allocate_next(&ubuffer, (void **) &item_pushed, sizeof(int)); 85 | ubuffer_free_first(&ubuffer, (void **) &item_poped, sizeof(int)); 86 | TEST_ASSERT_EQUAL(item_pushed, item_poped); 87 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY, ubuffer.capacity); 88 | TEST_ASSERT_EQUAL(buffer_memory, ubuffer.start); 89 | TEST_ASSERT_EQUAL(0, ubuffer.head); 90 | TEST_ASSERT_EQUAL(0, ubuffer.size); 91 | TEST_ASSERT_EQUAL(0, mock_critical_section_state()); 92 | } 93 | 94 | TEST(TestUbuffer, Test_Full) { 95 | int *item; 96 | 97 | fill_buffer(); 98 | clone_buffer(); 99 | 100 | TEST_ASSERT_EQUAL(UBUFFER_FULL, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 101 | assert_buffer_equal_clone(); 102 | } 103 | 104 | TEST(TestUbuffer, Test_Empty) { 105 | int *item; 106 | 107 | clone_buffer(); 108 | 109 | TEST_ASSERT_EQUAL(UBUFFER_EMPTY, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 110 | assert_buffer_equal_clone(); 111 | } 112 | 113 | TEST(TestUbuffer, Test_Circular_Tail) { 114 | int *item; 115 | 116 | // Fill the buffer to the maximum amount of integers possible 117 | fill_buffer(); 118 | 119 | // Take one item out 120 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 121 | TEST_ASSERT_EQUAL(0, *item); 122 | 123 | // Add one item (first cyclic function) 124 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 125 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY % sizeof(int), ubuffer.num_empty_bytes_at_end); 126 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY, ubuffer.size); 127 | *item = MAX_INT_TYPE_IN_BUFFER; 128 | TEST_ASSERT_EQUAL(buffer_memory, item); 129 | 130 | // Try to add one more item when buffer is full 131 | TEST_ASSERT_EQUAL(UBUFFER_FULL, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 132 | 133 | empty_a_full_buffer(1); 134 | 135 | //make sure we can add more after emptyinh 136 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 137 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_peek_first(&ubuffer, (void **) &item, sizeof(int))); 138 | TEST_ASSERT_EQUAL(0, mock_critical_section_state()); 139 | } 140 | 141 | TEST(TestUbuffer, Test_Nrf_Scenario) { 142 | int *item; 143 | 144 | // Fill the buffer to the maximum amount of integers possible 145 | fill_buffer(); 146 | 147 | // Take 2 item out 148 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 149 | TEST_ASSERT_EQUAL(0, *item); 150 | 151 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 152 | TEST_ASSERT_EQUAL(1, *item); 153 | 154 | // Add one item (first cyclic function) 155 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 156 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY % sizeof(int), ubuffer.num_empty_bytes_at_end); 157 | TEST_ASSERT_EQUAL(11, ubuffer.size); 158 | *item = MAX_INT_TYPE_IN_BUFFER; 159 | TEST_ASSERT_EQUAL(buffer_memory, item); 160 | 161 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 162 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY % sizeof(int), ubuffer.num_empty_bytes_at_end); 163 | TEST_ASSERT_EQUAL(BUFFER_CAPACITY, ubuffer.size); 164 | *item = MAX_INT_TYPE_IN_BUFFER + 1; 165 | TEST_ASSERT_EQUAL(buffer_memory + sizeof(int), item); 166 | 167 | // Try to add one more item when buffer is full 168 | TEST_ASSERT_EQUAL(UBUFFER_FULL, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 169 | 170 | for (int i = 0; i < MAX_INT_TYPE_IN_BUFFER; i++) { 171 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void **) &item, sizeof(int))); 172 | TEST_ASSERT_EQUAL(i + 2, *item); 173 | } 174 | 175 | //make sure we can add more after emptyinh 176 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 177 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_peek_first(&ubuffer, (void **) &item, sizeof(int))); 178 | } 179 | 180 | TEST(TestUbuffer, Test_Circular_Head) { 181 | int *item; 182 | 183 | // Bring the head to the end (minus num_empty_bytes_at_end) of the buffer 184 | fill_buffer(); 185 | empty_a_full_buffer(0); 186 | 187 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 188 | TEST_ASSERT_EQUAL(buffer_memory, item); 189 | TEST_ASSERT_EQUAL(sizeof(int), ubuffer.size); 190 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_peek_first(&ubuffer, (void **) &item, sizeof(int))); 191 | } 192 | 193 | TEST(TestUbuffer, Test_Free_Size_0) { 194 | int *item; 195 | 196 | fill_buffer(); 197 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void**) &item, 0)); 198 | TEST_ASSERT_EQUAL(buffer_memory, item); 199 | } 200 | 201 | TEST(TestUbuffer, Test_Free_Size_0_When_Empty) { 202 | int *item; 203 | 204 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_free_first(&ubuffer, (void**) &item, 0)); 205 | TEST_ASSERT_EQUAL(buffer_memory, item); 206 | } 207 | 208 | TEST(TestUbuffer, Test_Free_Item_Too_Large) { 209 | int *item; 210 | 211 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_allocate_next(&ubuffer, (void **) &item, sizeof(int))); 212 | TEST_ASSERT_EQUAL(UBUFFER_EMPTY, ubuffer_free_first(&ubuffer, (void**) &item, sizeof(int) + 1)); 213 | } 214 | 215 | TEST(TestUbuffer, Test_Free_Item_Too_Large_With_Empty_Bytes_At_End) { 216 | int *item; 217 | 218 | ubuffer.num_empty_bytes_at_end = 2; 219 | ubuffer.head = ubuffer.head + ubuffer.capacity - 3; 220 | ubuffer.size = 4; 221 | 222 | TEST_ASSERT_EQUAL(UBUFFER_EMPTY, ubuffer_free_first(&ubuffer, (void**) &item, 2)); 223 | } 224 | 225 | TEST(TestUbuffer, Test_Peek) { 226 | int * item; 227 | 228 | fill_buffer(); 229 | clone_buffer(); 230 | TEST_ASSERT_EQUAL(UBUFFER_SUCCESS, ubuffer_peek_first(&ubuffer, (void**) &item, sizeof(int))); 231 | TEST_ASSERT_EQUAL(buffer_memory, item); 232 | assert_buffer_equal_clone(); 233 | } -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10028/s130/armgcc/Makefile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME := ble_app_template_pca10028_s130 2 | TARGETS := nrf51422_xxac 3 | OUTPUT_DIRECTORY := _build 4 | 5 | SDK_ROOT := ../../../../../.. 6 | PROJ_DIR := ../../.. 7 | 8 | $(OUTPUT_DIRECTORY)/nrf51422_xxac.out: \ 9 | LINKER_SCRIPT := ble_app_template_gcc_nrf51.ld 10 | 11 | # Source files common to all targets 12 | SRC_FILES += \ 13 | $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \ 14 | $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \ 15 | $(SDK_ROOT)/components/libraries/button/app_button.c \ 16 | $(SDK_ROOT)/components/libraries/util/app_error.c \ 17 | $(SDK_ROOT)/components/libraries/util/app_error_weak.c \ 18 | $(SDK_ROOT)/components/libraries/timer/app_timer.c \ 19 | $(SDK_ROOT)/components/libraries/util/app_util_platform.c \ 20 | $(SDK_ROOT)/components/libraries/crc16/crc16.c \ 21 | $(SDK_ROOT)/components/libraries/fds/fds.c \ 22 | $(SDK_ROOT)/components/libraries/fstorage/fstorage.c \ 23 | $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \ 24 | $(SDK_ROOT)/components/libraries/util/nrf_assert.c \ 25 | $(SDK_ROOT)/components/libraries/util/sdk_errors.c \ 26 | $(SDK_ROOT)/components/libraries/util/sdk_mapped_flags.c \ 27 | $(SDK_ROOT)/components/libraries/sensorsim/sensorsim.c \ 28 | $(SDK_ROOT)/components/boards/boards.c \ 29 | $(SDK_ROOT)/components/drivers_nrf/clock/nrf_drv_clock.c \ 30 | $(SDK_ROOT)/components/drivers_nrf/common/nrf_drv_common.c \ 31 | $(SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \ 32 | $(SDK_ROOT)/components/drivers_nrf/uart/nrf_drv_uart.c \ 33 | $(SDK_ROOT)/components/libraries/bsp/bsp.c \ 34 | $(SDK_ROOT)/components/libraries/bsp/bsp_btn_ble.c \ 35 | $(SDK_ROOT)/components/libraries/bsp/bsp_nfc.c \ 36 | $(PROJ_DIR)/main.c \ 37 | $(SDK_ROOT)/external/segger_rtt/RTT_Syscalls_GCC.c \ 38 | $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \ 39 | $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \ 40 | $(SDK_ROOT)/components/ble/common/ble_advdata.c \ 41 | $(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \ 42 | $(SDK_ROOT)/components/ble/common/ble_conn_params.c \ 43 | $(SDK_ROOT)/components/ble/common/ble_conn_state.c \ 44 | $(SDK_ROOT)/components/ble/common/ble_srv_common.c \ 45 | $(SDK_ROOT)/components/ble/peer_manager/gatt_cache_manager.c \ 46 | $(SDK_ROOT)/components/ble/peer_manager/gatts_cache_manager.c \ 47 | $(SDK_ROOT)/components/ble/peer_manager/id_manager.c \ 48 | $(SDK_ROOT)/components/ble/peer_manager/peer_data.c \ 49 | $(SDK_ROOT)/components/ble/peer_manager/peer_data_storage.c \ 50 | $(SDK_ROOT)/components/ble/peer_manager/peer_database.c \ 51 | $(SDK_ROOT)/components/ble/peer_manager/peer_id.c \ 52 | $(SDK_ROOT)/components/ble/peer_manager/peer_manager.c \ 53 | $(SDK_ROOT)/components/ble/peer_manager/pm_buffer.c \ 54 | $(SDK_ROOT)/components/ble/peer_manager/pm_mutex.c \ 55 | $(SDK_ROOT)/components/ble/peer_manager/security_dispatcher.c \ 56 | $(SDK_ROOT)/components/ble/peer_manager/security_manager.c \ 57 | $(SDK_ROOT)/components/toolchain/gcc/gcc_startup_nrf51.S \ 58 | $(SDK_ROOT)/components/toolchain/system_nrf51.c \ 59 | $(SDK_ROOT)/components/softdevice/common/softdevice_handler/softdevice_handler.c \ 60 | 61 | # Include folders common to all targets 62 | INC_FOLDERS += \ 63 | $(SDK_ROOT)/components/drivers_nrf/comp \ 64 | $(SDK_ROOT)/components/drivers_nrf/twi_master \ 65 | $(SDK_ROOT)/components/ble/ble_services/ble_ancs_c \ 66 | $(SDK_ROOT)/components/ble/ble_services/ble_ias_c \ 67 | $(SDK_ROOT)/components/softdevice/s130/headers \ 68 | $(SDK_ROOT)/components/libraries/pwm \ 69 | $(SDK_ROOT)/components/libraries/usbd/class/cdc/acm \ 70 | $(SDK_ROOT)/components/libraries/usbd/class/hid/generic \ 71 | $(SDK_ROOT)/components/libraries/usbd/class/msc \ 72 | $(SDK_ROOT)/components/libraries/usbd/class/hid \ 73 | $(SDK_ROOT)/components/libraries/log \ 74 | $(SDK_ROOT)/components/ble/ble_services/ble_gls \ 75 | $(SDK_ROOT)/components/libraries/fstorage \ 76 | $(SDK_ROOT)/components/drivers_nrf/i2s \ 77 | $(SDK_ROOT)/components/libraries/gpiote \ 78 | $(SDK_ROOT)/components/drivers_nrf/gpiote \ 79 | $(SDK_ROOT)/components/boards \ 80 | $(SDK_ROOT)/components/drivers_nrf/common \ 81 | $(SDK_ROOT)/components/ble/ble_advertising \ 82 | $(SDK_ROOT)/components/drivers_nrf/adc \ 83 | $(SDK_ROOT)/components/softdevice/s130/headers/nrf51 \ 84 | $(SDK_ROOT)/components/ble/ble_services/ble_bas_c \ 85 | $(SDK_ROOT)/components/ble/ble_services/ble_hrs_c \ 86 | $(SDK_ROOT)/components/libraries/queue \ 87 | $(SDK_ROOT)/components/ble/ble_dtm \ 88 | $(SDK_ROOT)/components/toolchain/cmsis/include \ 89 | $(SDK_ROOT)/components/ble/ble_services/ble_rscs_c \ 90 | $(SDK_ROOT)/components/drivers_nrf/uart \ 91 | $(SDK_ROOT)/components/ble/common \ 92 | $(SDK_ROOT)/components/ble/ble_services/ble_lls \ 93 | $(SDK_ROOT)/components/drivers_nrf/wdt \ 94 | $(SDK_ROOT)/components/libraries/bsp \ 95 | $(SDK_ROOT)/components/ble/ble_services/ble_bas \ 96 | $(SDK_ROOT)/components/libraries/experimental_section_vars \ 97 | $(SDK_ROOT)/components/ble/ble_services/ble_ans_c \ 98 | $(SDK_ROOT)/components/libraries/slip \ 99 | $(SDK_ROOT)/components/libraries/mem_manager \ 100 | $(SDK_ROOT)/external/segger_rtt \ 101 | $(SDK_ROOT)/components/libraries/csense_drv \ 102 | $(SDK_ROOT)/components/drivers_nrf/hal \ 103 | $(SDK_ROOT)/components/ble/ble_services/ble_nus_c \ 104 | $(SDK_ROOT)/components/drivers_nrf/rtc \ 105 | $(SDK_ROOT)/components/ble/ble_services/ble_ias \ 106 | $(SDK_ROOT)/components/libraries/usbd/class/hid/mouse \ 107 | $(SDK_ROOT)/components/drivers_nrf/ppi \ 108 | $(SDK_ROOT)/components/ble/ble_services/ble_dfu \ 109 | $(SDK_ROOT)/components/drivers_nrf/twis_slave \ 110 | $(SDK_ROOT)/components \ 111 | $(SDK_ROOT)/components/libraries/scheduler \ 112 | $(SDK_ROOT)/components/ble/ble_services/ble_lbs \ 113 | $(SDK_ROOT)/components/ble/ble_services/ble_hts \ 114 | $(SDK_ROOT)/components/drivers_nrf/delay \ 115 | $(SDK_ROOT)/components/libraries/crc16 \ 116 | $(SDK_ROOT)/components/drivers_nrf/timer \ 117 | $(SDK_ROOT)/components/libraries/util \ 118 | $(SDK_ROOT)/components/drivers_nrf/pwm \ 119 | ../config \ 120 | $(SDK_ROOT)/components/libraries/usbd/class/cdc \ 121 | $(SDK_ROOT)/components/libraries/csense \ 122 | $(SDK_ROOT)/components/drivers_nrf/rng \ 123 | $(SDK_ROOT)/components/libraries/low_power_pwm \ 124 | $(SDK_ROOT)/components/libraries/hardfault \ 125 | $(SDK_ROOT)/components/ble/ble_services/ble_cscs \ 126 | $(SDK_ROOT)/components/libraries/uart \ 127 | $(SDK_ROOT)/components/libraries/hci \ 128 | $(SDK_ROOT)/components/libraries/usbd/class/hid/kbd \ 129 | $(SDK_ROOT)/components/drivers_nrf/spi_slave \ 130 | $(SDK_ROOT)/components/drivers_nrf/lpcomp \ 131 | $(SDK_ROOT)/components/libraries/timer \ 132 | $(SDK_ROOT)/components/drivers_nrf/power \ 133 | $(SDK_ROOT)/components/libraries/usbd/config \ 134 | $(SDK_ROOT)/components/toolchain \ 135 | $(SDK_ROOT)/components/libraries/led_softblink \ 136 | $(SDK_ROOT)/components/drivers_nrf/qdec \ 137 | $(SDK_ROOT)/components/ble/ble_services/ble_cts_c \ 138 | $(SDK_ROOT)/components/drivers_nrf/spi_master \ 139 | $(SDK_ROOT)/components/ble/ble_services/ble_nus \ 140 | $(SDK_ROOT)/components/ble/ble_services/ble_hids \ 141 | $(SDK_ROOT)/components/drivers_nrf/pdm \ 142 | $(SDK_ROOT)/components/libraries/crc32 \ 143 | $(SDK_ROOT)/components/libraries/usbd/class/audio \ 144 | $(SDK_ROOT)/components/libraries/sensorsim \ 145 | $(SDK_ROOT)/components/ble/peer_manager \ 146 | $(SDK_ROOT)/components/drivers_nrf/swi \ 147 | $(SDK_ROOT)/components/ble/ble_services/ble_tps \ 148 | $(SDK_ROOT)/components/ble/ble_services/ble_dis \ 149 | $(SDK_ROOT)/components/device \ 150 | $(SDK_ROOT)/components/ble/nrf_ble_qwr \ 151 | $(SDK_ROOT)/components/libraries/button \ 152 | $(SDK_ROOT)/components/libraries/usbd \ 153 | $(SDK_ROOT)/components/drivers_nrf/saadc \ 154 | $(SDK_ROOT)/components/ble/ble_services/ble_lbs_c \ 155 | $(SDK_ROOT)/components/ble/ble_racp \ 156 | $(SDK_ROOT)/components/toolchain/gcc \ 157 | $(SDK_ROOT)/components/libraries/fds \ 158 | $(SDK_ROOT)/components/libraries/twi \ 159 | $(SDK_ROOT)/components/drivers_nrf/clock \ 160 | $(SDK_ROOT)/components/ble/ble_services/ble_rscs \ 161 | $(SDK_ROOT)/components/drivers_nrf/usbd \ 162 | $(SDK_ROOT)/components/softdevice/common/softdevice_handler \ 163 | $(SDK_ROOT)/components/ble/ble_services/ble_hrs \ 164 | $(SDK_ROOT)/components/libraries/log/src \ 165 | 166 | # Libraries common to all targets 167 | LIB_FILES += \ 168 | 169 | # C flags common to all targets 170 | CFLAGS += -DBOARD_PCA10028 171 | CFLAGS += -DSOFTDEVICE_PRESENT 172 | CFLAGS += -DNRF51 173 | CFLAGS += -DS130 174 | CFLAGS += -DBLE_STACK_SUPPORT_REQD 175 | CFLAGS += -DSWI_DISABLE0 176 | CFLAGS += -DNRF51422 177 | CFLAGS += -DNRF_SD_BLE_API_VERSION=2 178 | CFLAGS += -mcpu=cortex-m0 179 | CFLAGS += -mthumb -mabi=aapcs 180 | CFLAGS += -Wall -Werror -O3 -g3 181 | CFLAGS += -mfloat-abi=soft 182 | # keep every function in separate section, this allows linker to discard unused ones 183 | CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing 184 | CFLAGS += -fno-builtin --short-enums 185 | 186 | # C++ flags common to all targets 187 | CXXFLAGS += \ 188 | 189 | # Assembler flags common to all targets 190 | ASMFLAGS += -x assembler-with-cpp 191 | ASMFLAGS += -DBOARD_PCA10028 192 | ASMFLAGS += -DSOFTDEVICE_PRESENT 193 | ASMFLAGS += -DNRF51 194 | ASMFLAGS += -DS130 195 | ASMFLAGS += -DBLE_STACK_SUPPORT_REQD 196 | ASMFLAGS += -DSWI_DISABLE0 197 | ASMFLAGS += -DNRF51422 198 | ASMFLAGS += -DNRF_SD_BLE_API_VERSION=2 199 | 200 | # Linker flags 201 | LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) 202 | LDFLAGS += -mcpu=cortex-m0 203 | # let linker to dump unused sections 204 | LDFLAGS += -Wl,--gc-sections 205 | # use newlib in nano version 206 | LDFLAGS += --specs=nano.specs -lc -lnosys 207 | 208 | 209 | .PHONY: $(TARGETS) default all clean help flash flash_softdevice 210 | 211 | # Default target - first one defined 212 | default: nrf51422_xxac 213 | 214 | # Print all targets that can be built 215 | help: 216 | @echo following targets are available: 217 | @echo nrf51422_xxac 218 | 219 | TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc 220 | 221 | include $(TEMPLATE_PATH)/Makefile.common 222 | 223 | $(foreach target, $(TARGETS), $(call define_target, $(target))) 224 | 225 | # Flash the program 226 | flash: $(OUTPUT_DIRECTORY)/nrf51422_xxac.hex 227 | @echo Flashing: $< 228 | nrfjprog --program $< -f nrf51 --sectorerase 229 | nrfjprog --reset -f nrf51 230 | 231 | # Flash softdevice 232 | flash_softdevice: 233 | @echo Flashing: s130_nrf51_2.0.1_softdevice.hex 234 | nrfjprog --program $(SDK_ROOT)/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex -f nrf51 --sectorerase 235 | nrfjprog --reset -f nrf51 236 | 237 | erase: 238 | nrfjprog --eraseall -f nrf52 239 | -------------------------------------------------------------------------------- /samples/nrf52-ble-template-sdk12.3/pca10056/s132/armgcc/Makefile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME := ble_app_template_pca10056_s132 2 | TARGETS := nrf52840_xxaa 3 | OUTPUT_DIRECTORY := _build 4 | 5 | SDK_ROOT := ../../../../../.. 6 | PROJ_DIR := ../../.. 7 | 8 | $(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \ 9 | LINKER_SCRIPT := ble_app_template_gcc_nrf52.ld 10 | 11 | # Source files common to all targets 12 | SRC_FILES += \ 13 | $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \ 14 | $(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \ 15 | $(SDK_ROOT)/components/libraries/button/app_button.c \ 16 | $(SDK_ROOT)/components/libraries/util/app_error.c \ 17 | $(SDK_ROOT)/components/libraries/util/app_error_weak.c \ 18 | $(SDK_ROOT)/components/libraries/timer/app_timer.c \ 19 | $(SDK_ROOT)/components/libraries/util/app_util_platform.c \ 20 | $(SDK_ROOT)/components/libraries/crc16/crc16.c \ 21 | $(SDK_ROOT)/components/libraries/fds/fds.c \ 22 | $(SDK_ROOT)/components/libraries/fstorage/fstorage.c \ 23 | $(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \ 24 | $(SDK_ROOT)/components/libraries/util/nrf_assert.c \ 25 | $(SDK_ROOT)/components/libraries/util/sdk_errors.c \ 26 | $(SDK_ROOT)/components/libraries/util/sdk_mapped_flags.c \ 27 | $(SDK_ROOT)/components/libraries/sensorsim/sensorsim.c \ 28 | $(SDK_ROOT)/components/boards/boards.c \ 29 | $(SDK_ROOT)/components/drivers_nrf/clock/nrf_drv_clock.c \ 30 | $(SDK_ROOT)/components/drivers_nrf/common/nrf_drv_common.c \ 31 | $(SDK_ROOT)/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \ 32 | $(SDK_ROOT)/components/drivers_nrf/uart/nrf_drv_uart.c \ 33 | $(SDK_ROOT)/components/libraries/bsp/bsp.c \ 34 | $(SDK_ROOT)/components/libraries/bsp/bsp_btn_ble.c \ 35 | $(SDK_ROOT)/components/libraries/bsp/bsp_nfc.c \ 36 | $(PROJ_DIR)/main.c \ 37 | $(SDK_ROOT)/external/segger_rtt/RTT_Syscalls_GCC.c \ 38 | $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \ 39 | $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \ 40 | $(SDK_ROOT)/components/ble/common/ble_advdata.c \ 41 | $(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \ 42 | $(SDK_ROOT)/components/ble/common/ble_conn_params.c \ 43 | $(SDK_ROOT)/components/ble/common/ble_conn_state.c \ 44 | $(SDK_ROOT)/components/ble/common/ble_srv_common.c \ 45 | $(SDK_ROOT)/components/ble/peer_manager/gatt_cache_manager.c \ 46 | $(SDK_ROOT)/components/ble/peer_manager/gatts_cache_manager.c \ 47 | $(SDK_ROOT)/components/ble/peer_manager/id_manager.c \ 48 | $(SDK_ROOT)/components/ble/peer_manager/peer_data.c \ 49 | $(SDK_ROOT)/components/ble/peer_manager/peer_data_storage.c \ 50 | $(SDK_ROOT)/components/ble/peer_manager/peer_database.c \ 51 | $(SDK_ROOT)/components/ble/peer_manager/peer_id.c \ 52 | $(SDK_ROOT)/components/ble/peer_manager/peer_manager.c \ 53 | $(SDK_ROOT)/components/ble/peer_manager/pm_buffer.c \ 54 | $(SDK_ROOT)/components/ble/peer_manager/pm_mutex.c \ 55 | $(SDK_ROOT)/components/ble/peer_manager/security_dispatcher.c \ 56 | $(SDK_ROOT)/components/ble/peer_manager/security_manager.c \ 57 | $(SDK_ROOT)/components/toolchain/gcc/gcc_startup_nrf52840.S \ 58 | $(SDK_ROOT)/components/toolchain/system_nrf52840.c \ 59 | $(SDK_ROOT)/components/softdevice/common/softdevice_handler/softdevice_handler.c \ 60 | 61 | # Include folders common to all targets 62 | INC_FOLDERS += \ 63 | $(SDK_ROOT)/components/drivers_nrf/comp \ 64 | $(SDK_ROOT)/components/drivers_nrf/twi_master \ 65 | $(SDK_ROOT)/components/ble/ble_services/ble_ancs_c \ 66 | $(SDK_ROOT)/components/ble/ble_services/ble_ias_c \ 67 | $(SDK_ROOT)/components/libraries/pwm \ 68 | $(SDK_ROOT)/components/softdevice/s132/headers/nrf52 \ 69 | $(SDK_ROOT)/components/libraries/usbd/class/cdc/acm \ 70 | $(SDK_ROOT)/components/libraries/usbd/class/hid/generic \ 71 | $(SDK_ROOT)/components/libraries/usbd/class/msc \ 72 | $(SDK_ROOT)/components/libraries/usbd/class/hid \ 73 | $(SDK_ROOT)/components/libraries/log \ 74 | $(SDK_ROOT)/components/ble/ble_services/ble_gls \ 75 | $(SDK_ROOT)/components/libraries/fstorage \ 76 | $(SDK_ROOT)/components/drivers_nrf/i2s \ 77 | $(SDK_ROOT)/components/libraries/gpiote \ 78 | $(SDK_ROOT)/components/drivers_nrf/gpiote \ 79 | $(SDK_ROOT)/components/boards \ 80 | $(SDK_ROOT)/components/drivers_nrf/common \ 81 | $(SDK_ROOT)/components/ble/ble_advertising \ 82 | $(SDK_ROOT)/components/drivers_nrf/adc \ 83 | $(SDK_ROOT)/components/ble/ble_services/ble_bas_c \ 84 | $(SDK_ROOT)/components/ble/ble_services/ble_hrs_c \ 85 | $(SDK_ROOT)/components/libraries/queue \ 86 | $(SDK_ROOT)/components/ble/ble_dtm \ 87 | $(SDK_ROOT)/components/toolchain/cmsis/include \ 88 | $(SDK_ROOT)/components/ble/ble_services/ble_rscs_c \ 89 | $(SDK_ROOT)/components/drivers_nrf/uart \ 90 | $(SDK_ROOT)/components/ble/common \ 91 | $(SDK_ROOT)/components/ble/ble_services/ble_lls \ 92 | $(SDK_ROOT)/components/drivers_nrf/wdt \ 93 | $(SDK_ROOT)/components/libraries/bsp \ 94 | $(SDK_ROOT)/components/ble/ble_services/ble_bas \ 95 | $(SDK_ROOT)/components/libraries/experimental_section_vars \ 96 | $(SDK_ROOT)/components/softdevice/s132/headers \ 97 | $(SDK_ROOT)/components/ble/ble_services/ble_ans_c \ 98 | $(SDK_ROOT)/components/libraries/slip \ 99 | $(SDK_ROOT)/components/libraries/mem_manager \ 100 | $(SDK_ROOT)/external/segger_rtt \ 101 | $(SDK_ROOT)/components/libraries/csense_drv \ 102 | $(SDK_ROOT)/components/drivers_nrf/hal \ 103 | $(SDK_ROOT)/components/ble/ble_services/ble_nus_c \ 104 | $(SDK_ROOT)/components/drivers_nrf/rtc \ 105 | $(SDK_ROOT)/components/ble/ble_services/ble_ias \ 106 | $(SDK_ROOT)/components/libraries/usbd/class/hid/mouse \ 107 | $(SDK_ROOT)/components/drivers_nrf/ppi \ 108 | $(SDK_ROOT)/components/ble/ble_services/ble_dfu \ 109 | $(SDK_ROOT)/components/drivers_nrf/twis_slave \ 110 | $(SDK_ROOT)/components \ 111 | $(SDK_ROOT)/components/libraries/scheduler \ 112 | $(SDK_ROOT)/components/ble/ble_services/ble_lbs \ 113 | $(SDK_ROOT)/components/ble/ble_services/ble_hts \ 114 | $(SDK_ROOT)/components/drivers_nrf/delay \ 115 | $(SDK_ROOT)/components/libraries/crc16 \ 116 | $(SDK_ROOT)/components/drivers_nrf/timer \ 117 | $(SDK_ROOT)/components/libraries/util \ 118 | $(SDK_ROOT)/components/drivers_nrf/pwm \ 119 | ../config \ 120 | $(SDK_ROOT)/components/libraries/usbd/class/cdc \ 121 | $(SDK_ROOT)/components/libraries/csense \ 122 | $(SDK_ROOT)/components/drivers_nrf/rng \ 123 | $(SDK_ROOT)/components/libraries/low_power_pwm \ 124 | $(SDK_ROOT)/components/libraries/hardfault \ 125 | $(SDK_ROOT)/components/ble/ble_services/ble_cscs \ 126 | $(SDK_ROOT)/components/libraries/uart \ 127 | $(SDK_ROOT)/components/libraries/hci \ 128 | $(SDK_ROOT)/components/libraries/usbd/class/hid/kbd \ 129 | $(SDK_ROOT)/components/drivers_nrf/spi_slave \ 130 | $(SDK_ROOT)/components/drivers_nrf/lpcomp \ 131 | $(SDK_ROOT)/components/libraries/timer \ 132 | $(SDK_ROOT)/components/drivers_nrf/power \ 133 | $(SDK_ROOT)/components/libraries/usbd/config \ 134 | $(SDK_ROOT)/components/toolchain \ 135 | $(SDK_ROOT)/components/libraries/led_softblink \ 136 | $(SDK_ROOT)/components/drivers_nrf/qdec \ 137 | $(SDK_ROOT)/components/ble/ble_services/ble_cts_c \ 138 | $(SDK_ROOT)/components/drivers_nrf/spi_master \ 139 | $(SDK_ROOT)/components/ble/ble_services/ble_nus \ 140 | $(SDK_ROOT)/components/ble/ble_services/ble_hids \ 141 | $(SDK_ROOT)/components/drivers_nrf/pdm \ 142 | $(SDK_ROOT)/components/libraries/crc32 \ 143 | $(SDK_ROOT)/components/libraries/usbd/class/audio \ 144 | $(SDK_ROOT)/components/libraries/sensorsim \ 145 | $(SDK_ROOT)/components/ble/peer_manager \ 146 | $(SDK_ROOT)/components/drivers_nrf/swi \ 147 | $(SDK_ROOT)/components/ble/ble_services/ble_tps \ 148 | $(SDK_ROOT)/components/ble/ble_services/ble_dis \ 149 | $(SDK_ROOT)/components/device \ 150 | $(SDK_ROOT)/components/ble/nrf_ble_qwr \ 151 | $(SDK_ROOT)/components/libraries/button \ 152 | $(SDK_ROOT)/components/libraries/usbd \ 153 | $(SDK_ROOT)/components/drivers_nrf/saadc \ 154 | $(SDK_ROOT)/components/ble/ble_services/ble_lbs_c \ 155 | $(SDK_ROOT)/components/ble/ble_racp \ 156 | $(SDK_ROOT)/components/toolchain/gcc \ 157 | $(SDK_ROOT)/components/libraries/fds \ 158 | $(SDK_ROOT)/components/libraries/twi \ 159 | $(SDK_ROOT)/components/drivers_nrf/clock \ 160 | $(SDK_ROOT)/components/ble/ble_services/ble_rscs \ 161 | $(SDK_ROOT)/components/drivers_nrf/usbd \ 162 | $(SDK_ROOT)/components/softdevice/common/softdevice_handler \ 163 | $(SDK_ROOT)/components/ble/ble_services/ble_hrs \ 164 | $(SDK_ROOT)/components/libraries/log/src \ 165 | 166 | # Libraries common to all targets 167 | LIB_FILES += \ 168 | 169 | # C flags common to all targets 170 | CFLAGS += -DNRF52840_XXAA 171 | CFLAGS += -DSWI_DISABLE0 172 | CFLAGS += -DSOFTDEVICE_PRESENT 173 | CFLAGS += -DBLE_STACK_SUPPORT_REQD 174 | CFLAGS += -DCONFIG_GPIO_AS_PINRESET 175 | CFLAGS += -DS132 176 | CFLAGS += -DBOARD_PCA10056 177 | CFLAGS += -DNRF_SD_BLE_API_VERSION=3 178 | CFLAGS += -mcpu=cortex-m4 179 | CFLAGS += -mthumb -mabi=aapcs 180 | CFLAGS += -Wall -Werror -O3 -g3 181 | CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 182 | # keep every function in separate section, this allows linker to discard unused ones 183 | CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing 184 | CFLAGS += -fno-builtin --short-enums 185 | 186 | # C++ flags common to all targets 187 | CXXFLAGS += \ 188 | 189 | # Assembler flags common to all targets 190 | ASMFLAGS += -x assembler-with-cpp 191 | ASMFLAGS += -DNRF52840_XXAA 192 | ASMFLAGS += -DSWI_DISABLE0 193 | ASMFLAGS += -DSOFTDEVICE_PRESENT 194 | ASMFLAGS += -DBLE_STACK_SUPPORT_REQD 195 | ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET 196 | ASMFLAGS += -DS132 197 | ASMFLAGS += -DBOARD_PCA10056 198 | ASMFLAGS += -DNRF_SD_BLE_API_VERSION=3 199 | 200 | # Linker flags 201 | LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) 202 | LDFLAGS += -mcpu=cortex-m4 203 | LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 204 | # let linker to dump unused sections 205 | LDFLAGS += -Wl,--gc-sections 206 | # use newlib in nano version 207 | LDFLAGS += --specs=nano.specs -lc -lnosys 208 | 209 | 210 | .PHONY: $(TARGETS) default all clean help flash flash_softdevice 211 | 212 | # Default target - first one defined 213 | default: nrf52840_xxaa 214 | 215 | # Print all targets that can be built 216 | help: 217 | @echo following targets are available: 218 | @echo nrf52840_xxaa 219 | 220 | TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc 221 | 222 | include $(TEMPLATE_PATH)/Makefile.common 223 | 224 | $(foreach target, $(TARGETS), $(call define_target, $(target))) 225 | 226 | # Flash the program 227 | flash: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex 228 | @echo Flashing: $< 229 | nrfjprog --program $< -f nrf52 --sectorerase 230 | nrfjprog --reset -f nrf52 231 | 232 | # Flash softdevice 233 | flash_softdevice: 234 | @echo Flashing: s132_nrf52_3.0.0_softdevice.hex 235 | nrfjprog --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex -f nrf52 --sectorerase 236 | nrfjprog --reset -f nrf52 237 | 238 | erase: 239 | nrfjprog --eraseall -f nrf52 240 | -------------------------------------------------------------------------------- /platforms/nrf52/gatt_handler.c: -------------------------------------------------------------------------------- 1 | #include "logging_config.h" 2 | 3 | #if ULOGGER_PLATFORM == PLATFORM_NRF52 4 | 5 | #include "sdk_common.h" 6 | #include "gatt_handler.h" 7 | #include "ble_srv_common.h" 8 | #include "ble.h" 9 | #include "ble_srv_common.h" 10 | #include "ulogger.h" 11 | #include "ubuffer.h" 12 | #include "app_timer.h" 13 | #include "logging_config.h" 14 | 15 | #define NRF_LOG_MODULE_NAME "GATT_LOG" 16 | #include "nrf_log.h" 17 | #include "network_log_handler.h" 18 | 19 | APP_TIMER_DEF(send_log_timer); 20 | 21 | static const ble_uuid128_t jumper_log_uuid = { 22 | { 23 | //8ff40000-0a29-4a73-ab8d-b16ce0f1a2df 24 | 0xdf, 0xa2, 0xf1, 0xe0, 0x6c, 0xb1, 0x8d, 0xab, 0x73, 0x4a, 0x29, 0x0a, 0x00, 0x00, 0xf4, 0x8f 25 | } 26 | }; 27 | 28 | #define LOGGER_UUID_SERVICE 0x5677 29 | #define LOGGER_UUID_CHAR 0x5678 30 | #define LOGGER_UUID_TIME_CHAR 0x5679 31 | 32 | static int send_to_gatt(void * network_context, uint8_t * data, uint32_t length); 33 | static bool can_send_gatt_message(void * network_context); 34 | static int gatt_handler_logging_timer_start(network_log_config * config, uint32_t time_in_ms, periodic_callback_function func); 35 | 36 | static uint32_t add_timer_charactaristic(uLoggerGattHandler *handler) { 37 | ble_gatts_char_md_t charactaristic_metadata; 38 | ble_gatts_attr_md_t cccd_md; 39 | ble_gatts_attr_t attr_char_value; 40 | ble_uuid_t ble_uuid; 41 | ble_gatts_attr_md_t attr_md; 42 | 43 | memset(&cccd_md, 0, sizeof(cccd_md)); 44 | 45 | BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); 46 | BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); 47 | cccd_md.vloc = BLE_GATTS_VLOC_STACK; 48 | 49 | memset(&charactaristic_metadata, 0, sizeof(charactaristic_metadata)); 50 | 51 | charactaristic_metadata.char_props.read = 1; 52 | charactaristic_metadata.p_char_user_desc = NULL; 53 | charactaristic_metadata.p_char_pf = NULL; 54 | charactaristic_metadata.p_user_desc_md = NULL; 55 | charactaristic_metadata.p_cccd_md = &cccd_md; 56 | charactaristic_metadata.p_sccd_md = NULL; 57 | 58 | ble_uuid.type = handler->uuid_type; 59 | ble_uuid.uuid = LOGGER_UUID_TIME_CHAR; 60 | 61 | memset(&attr_md, 0, sizeof(attr_md)); 62 | 63 | BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); 64 | BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm); 65 | attr_md.vloc = BLE_GATTS_VLOC_STACK; 66 | attr_md.rd_auth = 1; 67 | attr_md.wr_auth = 0; 68 | attr_md.vlen = 1; 69 | 70 | memset(&attr_char_value, 0, sizeof(attr_char_value)); 71 | 72 | attr_char_value.p_uuid = &ble_uuid; 73 | attr_char_value.p_attr_md = &attr_md; 74 | attr_char_value.init_len = 4; 75 | attr_char_value.init_offs = 0; 76 | attr_char_value.max_len = 4; 77 | attr_char_value.p_value = NULL; 78 | 79 | return sd_ble_gatts_characteristic_add(handler->service_handle, &charactaristic_metadata, &attr_char_value, &handler->time_char_handle); 80 | } 81 | 82 | static uint32_t add_logging_chatactaristic(uLoggerGattHandler *handler) 83 | { 84 | ble_gatts_char_md_t charactaristic_metadata; 85 | ble_gatts_attr_md_t cccd_md; 86 | ble_gatts_attr_t attr_char_value; 87 | ble_uuid_t ble_uuid; 88 | ble_gatts_attr_md_t attr_md; 89 | 90 | memset(&cccd_md, 0, sizeof(cccd_md)); 91 | 92 | BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); 93 | BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); 94 | cccd_md.vloc = BLE_GATTS_VLOC_STACK; 95 | 96 | memset(&charactaristic_metadata, 0, sizeof(charactaristic_metadata)); 97 | 98 | charactaristic_metadata.char_props.read = 1; 99 | charactaristic_metadata.char_props.notify = 1; 100 | charactaristic_metadata.p_char_user_desc = NULL; 101 | charactaristic_metadata.p_char_pf = NULL; 102 | charactaristic_metadata.p_user_desc_md = NULL; 103 | charactaristic_metadata.p_cccd_md = &cccd_md; 104 | charactaristic_metadata.p_sccd_md = NULL; 105 | 106 | ble_uuid.type = handler->uuid_type; 107 | ble_uuid.uuid = LOGGER_UUID_CHAR; 108 | 109 | memset(&attr_md, 0, sizeof(attr_md)); 110 | 111 | BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); 112 | BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm); 113 | attr_md.vloc = BLE_GATTS_VLOC_STACK; 114 | attr_md.rd_auth = 0; 115 | attr_md.wr_auth = 0; 116 | attr_md.vlen = 1; 117 | 118 | memset(&attr_char_value, 0, sizeof(attr_char_value)); 119 | 120 | attr_char_value.p_uuid = &ble_uuid; 121 | attr_char_value.p_attr_md = &attr_md; 122 | attr_char_value.init_len = 20; 123 | attr_char_value.init_offs = 0; 124 | attr_char_value.max_len = 20; 125 | attr_char_value.p_value = NULL; 126 | 127 | return sd_ble_gatts_characteristic_add(handler->service_handle, &charactaristic_metadata, &attr_char_value, &handler->send_char_handles); 128 | } 129 | 130 | static uint32_t add_logging_service(uLoggerGattHandler * handler) { 131 | ble_uuid_t ble_uuid; 132 | uint32_t err_code; 133 | 134 | err_code = sd_ble_uuid_vs_add(&jumper_log_uuid, &handler->uuid_type); 135 | if (err_code != NRF_SUCCESS) { 136 | NRF_LOG_INFO("Failed at uuid\n"); 137 | return err_code; 138 | } 139 | 140 | ble_uuid.type = handler->uuid_type; 141 | ble_uuid.uuid = LOGGER_UUID_SERVICE; 142 | 143 | return sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &handler->service_handle); 144 | } 145 | 146 | static bool can_send_gatt_message(void * network_context) { 147 | uLoggerGattHandler * handler = (uLoggerGattHandler *) network_context; 148 | return (handler->connection_handle != BLE_CONN_HANDLE_INVALID); 149 | } 150 | 151 | static int disable_notifications(uLoggerGattHandler *handler) { 152 | uint16_t value = 0; 153 | ble_gatts_value_t gatts_value_to_write = { 154 | .len = sizeof(uint16_t), 155 | .offset = 0, 156 | .p_value = (uint8_t*) &value 157 | }; 158 | return sd_ble_gatts_value_set(handler->connection_handle, handler->send_char_handles.cccd_handle, &gatts_value_to_write); 159 | } 160 | 161 | uint32_t gatt_handler_init(network_log_config * config, uint8_t * buffer, uint32_t buffer_length) { 162 | uint32_t err_code; 163 | 164 | config->log_send_period = LOG_SEND_PERIOD_MS; 165 | config->send = send_to_gatt; 166 | config->can_send = can_send_gatt_message; 167 | 168 | uLoggerGattHandler * handler = (uLoggerGattHandler *) config->context; 169 | memset(handler, 0, sizeof(uLoggerGattHandler)); 170 | 171 | handler->connection_handle = BLE_CONN_HANDLE_INVALID; 172 | 173 | err_code = add_logging_service(handler); 174 | if (err_code != NRF_SUCCESS) { 175 | NRF_LOG_INFO("Failed at service\n"); 176 | return err_code; 177 | } 178 | 179 | err_code = add_logging_chatactaristic(handler); 180 | if (err_code != NRF_SUCCESS) { 181 | NRF_LOG_INFO("Failed at logging char\n"); 182 | return err_code; 183 | } 184 | 185 | err_code = add_timer_charactaristic(handler); 186 | if (err_code != NRF_SUCCESS) { 187 | NRF_LOG_INFO("Failed at timer char\n"); 188 | return err_code; 189 | } 190 | 191 | err_code = network_logger_init(config, buffer, buffer_length); 192 | if (err_code) { 193 | NRF_LOG_INFO("Failed at network logger\n"); 194 | return err_code; 195 | } 196 | 197 | gatt_handler_logging_timer_start(config, config->log_send_period, config->callback); 198 | 199 | return NRF_SUCCESS; 200 | } 201 | 202 | void gatt_handler_handle_ble_event(ble_evt_t *p_ble_evt, uLoggerGattHandler * handler) { 203 | ret_code_t err_code; 204 | 205 | switch (p_ble_evt->header.evt_id) { 206 | case BLE_GAP_EVT_CONNECTED: 207 | handler->connection_handle = p_ble_evt->evt.gap_evt.conn_handle; 208 | disable_notifications(handler); 209 | break; 210 | case BLE_GAP_EVT_DISCONNECTED: 211 | handler->connection_handle = BLE_CONN_HANDLE_INVALID; 212 | break; 213 | 214 | case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: 215 | { 216 | 217 | NRF_LOG_INFO("Auth request\n"); 218 | ble_gatts_evt_rw_authorize_request_t req; 219 | ble_gatts_rw_authorize_reply_params_t auth_reply; 220 | timestamp time; 221 | get_timestamp(&time); 222 | 223 | req = p_ble_evt->evt.gatts_evt.params.authorize_request; 224 | if (req.type == BLE_GATTS_AUTHORIZE_TYPE_READ) { 225 | 226 | auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ; 227 | auth_reply.params.read.len = sizeof(timestamp); 228 | auth_reply.params.read.p_data = (uint8_t*)&time; 229 | auth_reply.params.read.gatt_status = BLE_GATT_STATUS_SUCCESS; 230 | auth_reply.params.read.update = 1; 231 | auth_reply.params.read.offset = 0; 232 | 233 | NRF_LOG_INFO("Replying to read\n"); 234 | err_code = sd_ble_gatts_rw_authorize_reply(p_ble_evt->evt.gatts_evt.conn_handle, 235 | &auth_reply); 236 | APP_ERROR_CHECK(err_code); 237 | } 238 | } 239 | break; 240 | default: 241 | // No implementation needed. 242 | break; 243 | } 244 | } 245 | 246 | static int send_to_gatt(void * network_context, uint8_t * data, uint32_t length) { 247 | uLoggerGattHandler * handler = (uLoggerGattHandler *) network_context; 248 | //TODO assert length < uint16 249 | uint32_t err_code; 250 | uint16_t len = length; 251 | ble_gatts_hvx_params_t hvx_params = { 252 | .handle = handler->send_char_handles.value_handle, 253 | .type = BLE_GATT_HVX_NOTIFICATION, 254 | .p_len = &len, 255 | .p_data = data 256 | }; 257 | err_code = sd_ble_gatts_hvx(handler->connection_handle, &hvx_params); 258 | 259 | if (err_code != NRF_SUCCESS) { 260 | NRF_LOG_INFO("Failed to send log\n"); 261 | return 1; 262 | } 263 | return 0; 264 | } 265 | 266 | HandlerReturnType gatt_handler_handle_log(void * handler_data, LogLevel level, EventType event_type, timestamp time, void * data, size_t data_length) { 267 | network_log_config * config = (network_log_config *) handler_data; 268 | return network_handler_log(config, level, event_type, time, data, data_length); 269 | } 270 | 271 | static int gatt_handler_logging_timer_start(network_log_config * config, uint32_t time_in_ms, periodic_callback_function func) { 272 | uint32_t err_code; 273 | 274 | err_code = app_timer_create(&send_log_timer, APP_TIMER_MODE_REPEATED, func); 275 | if (err_code != NRF_SUCCESS) { 276 | NRF_LOG_INFO("Failed to create timer\n"); 277 | return err_code; 278 | } 279 | 280 | ret_code_t ret_code; 281 | ret_code = app_timer_start(send_log_timer, TICKS(time_in_ms) , (void *)config); 282 | if (ret_code) { 283 | NRF_LOG_INFO("Failed to create timer\n"); 284 | return ret_code; 285 | } 286 | 287 | return NRF_SUCCESS; 288 | } 289 | 290 | #endif 291 | -------------------------------------------------------------------------------- /doxygen-bootstrapped/doxy-boot.js: -------------------------------------------------------------------------------- 1 | $( document ).ready(function() { 2 | 3 | $("div.headertitle").addClass("page-header"); 4 | $("div.title").addClass("h1"); 5 | 6 | $('li > a[href="index.html"] > span').before(" "); 7 | $('li > a[href="modules.html"] > span').before(" "); 8 | $('li > a[href="namespaces.html"] > span').before(" "); 9 | $('li > a[href="annotated.html"] > span').before(" "); 10 | $('li > a[href="classes.html"] > span').before(" "); 11 | $('li > a[href="inherits.html"] > span').before(" "); 12 | $('li > a[href="functions.html"] > span').before(" "); 13 | $('li > a[href="functions_func.html"] > span').before(" "); 14 | $('li > a[href="functions_vars.html"] > span').before(" "); 15 | $('li > a[href="functions_enum.html"] > span').before(" "); 16 | $('li > a[href="functions_eval.html"] > span').before(" "); 17 | $('img[src="ftv2ns.png"]').replaceWith('N '); 18 | $('img[src="ftv2cl.png"]').replaceWith('C '); 19 | 20 | $("ul.tablist").addClass("nav nav-pills nav-justified"); 21 | $("ul.tablist").css("margin-top", "0.5em"); 22 | $("ul.tablist").css("margin-bottom", "0.5em"); 23 | $("li.current").addClass("active"); 24 | $("iframe").attr("scrolling", "yes"); 25 | 26 | $("#nav-path > ul").addClass("breadcrumb"); 27 | 28 | $("table.params").addClass("table"); 29 | $("div.ingroups").wrapInner(""); 30 | $("div.levels").css("margin", "0.5em"); 31 | $("div.levels > span").addClass("btn btn-default btn-xs"); 32 | $("div.levels > span").css("margin-right", "0.25em"); 33 | 34 | $("table.directory").addClass("table table-striped"); 35 | $("div.summary > a").addClass("btn btn-default btn-xs"); 36 | $("table.fieldtable").addClass("table"); 37 | $(".fragment").addClass("well"); 38 | $(".memitem").addClass("panel panel-default"); 39 | $(".memproto").addClass("panel-heading"); 40 | $(".memdoc").addClass("panel-body"); 41 | $("span.mlabel").addClass("label label-info"); 42 | 43 | $("table.memberdecls").addClass("table"); 44 | $("[class^=memitem]").addClass("active"); 45 | 46 | $("div.ah").addClass("btn btn-default"); 47 | $("span.mlabels").addClass("pull-right"); 48 | $("table.mlabels").css("width", "100%") 49 | $("td.mlabels-right").addClass("pull-right"); 50 | 51 | $("div.ttc").addClass("panel panel-primary"); 52 | $("div.ttname").addClass("panel-heading"); 53 | $("div.ttname a").css("color", 'white'); 54 | $("div.ttdef,div.ttdoc,div.ttdeci").addClass("panel-body"); 55 | 56 | $('div.fragment.well div.line:first').css('margin-top', '2px'); 57 | $('div.fragment.well div.line:last').css('margin-bottom', '2px'); 58 | 59 | $('table.doxtable').removeClass('doxtable').addClass('table table-striped table-bordered').each(function(){ 60 | $(this).prepend(''); 61 | $(this).find('tbody > tr:first').prependTo($(this).find('thead')); 62 | 63 | $(this).find('td > span.success').parent().addClass('success'); 64 | $(this).find('td > span.warning').parent().addClass('warning'); 65 | $(this).find('td > span.danger').parent().addClass('danger'); 66 | }); 67 | 68 | 69 | 70 | if($('div.fragment.well div.ttc').length > 0) 71 | { 72 | $('div.fragment.well div.line:first').parent().removeClass('fragment well'); 73 | } 74 | 75 | $('table.memberdecls').find('.memItemRight').each(function(){ 76 | $(this).contents().appendTo($(this).siblings('.memItemLeft')); 77 | $(this).siblings('.memItemLeft').attr('align', 'left'); 78 | }); 79 | 80 | $('table.memberdecls').find('.memTemplItemRight').each(function(){ 81 | $(this).contents().appendTo($(this).siblings('.memTemplItemLeft')); 82 | $(this).siblings('.memTemplItemLeft').attr('align', 'left'); 83 | }); 84 | 85 | function getOriginalWidthOfImg(img_element) { 86 | var t = new Image(); 87 | t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src; 88 | return t.width; 89 | } 90 | 91 | $('div.dyncontent').find('img').each(function(){ 92 | if(getOriginalWidthOfImg($(this)[0]) > $('#content>div.container').width()) 93 | $(this).css('width', '100%'); 94 | }); 95 | 96 | 97 | /* responsive search box */ 98 | $('#MSearchBox').parent().remove(); 99 | 100 | var nav_container = $('
'); 101 | $('#navrow1').parent().prepend(nav_container); 102 | 103 | var left_nav = $('
'); 104 | for (i = 0; i < 6; i++) { 105 | var navrow = $('#navrow' + i + ' > ul.tablist').detach(); 106 | left_nav.append(navrow); 107 | $('#navrow' + i).remove(); 108 | } 109 | var right_nav = $('
').append('\ 110 | '); 121 | $(nav_container).append(left_nav); 122 | $(nav_container).append(right_nav); 123 | 124 | $('#MSearchSelectWindow .SelectionMark').remove(); 125 | var search_selectors = $('#MSearchSelectWindow .SelectItem'); 126 | for (var i = 0; i < search_selectors.length; i += 1) { 127 | var element_a = $('').text($(search_selectors[i]).text()); 128 | 129 | element_a.click(function(){ 130 | $('#search-box .dropdown-menu li').removeClass('active'); 131 | $(this).parent().addClass('active'); 132 | searchBox.OnSelectItem($('#search-box li a').index(this)); 133 | searchBox.Search(); 134 | return false; 135 | }); 136 | 137 | var element = $('
  • ').append(element_a); 138 | $('#search-box .dropdown-menu').append(element); 139 | } 140 | $('#MSearchSelectWindow').remove(); 141 | 142 | $('#search-box .close').click(function (){ 143 | searchBox.CloseResultsWindow(); 144 | }); 145 | 146 | $('body').append('
    '); 147 | $('body').append('
    '); 148 | $('body').append('
    '); 149 | 150 | searchBox.searchLabel = ''; 151 | searchBox.DOMSearchField = function() { 152 | return document.getElementById("search-field"); 153 | } 154 | searchBox.DOMSearchClose = function(){ 155 | return document.getElementById("search-close"); 156 | } 157 | 158 | 159 | /* search results */ 160 | var results_iframe = $('#MSearchResults').detach(); 161 | $('#MSearchResultsWindow') 162 | .attr('id', 'search-results-window') 163 | .addClass('panel panel-default') 164 | .append( 165 | '
    \ 166 |

    Search Results

    \ 167 |
    \ 168 |
    ' 169 | ); 170 | $('#search-results-window .panel-body').append(results_iframe); 171 | 172 | searchBox.DOMPopupSearchResultsWindow = function() { 173 | return document.getElementById("search-results-window"); 174 | } 175 | 176 | function update_search_results_window() { 177 | $('#search-results-window').removeClass('panel-default panel-success panel-warning panel-danger') 178 | var status = $('#MSearchResults').contents().find('.SRStatus:visible'); 179 | if (status.length > 0) { 180 | switch(status.attr('id')) { 181 | case 'Loading': 182 | case 'Searching': 183 | $('#search-results-window').addClass('panel-warning'); 184 | break; 185 | case 'NoMatches': 186 | $('#search-results-window').addClass('panel-danger'); 187 | break; 188 | default: 189 | $('#search-results-window').addClass('panel-default'); 190 | } 191 | } else { 192 | $('#search-results-window').addClass('panel-success'); 193 | } 194 | } 195 | $('#MSearchResults').load(function() { 196 | $('#MSearchResults').contents().find('link[href="search.css"]').attr('href','../doxygen.css'); 197 | $('#MSearchResults').contents().find('head').append( 198 | ''); 199 | 200 | update_search_results_window(); 201 | 202 | // detect status changes (only for search with external search backend) 203 | var observer = new MutationObserver(function(mutations) { 204 | update_search_results_window(); 205 | }); 206 | var config = { attributes: true}; 207 | 208 | var targets = $('#MSearchResults').contents().find('.SRStatus'); 209 | for (i = 0; i < targets.length; i++) { 210 | observer.observe(targets[i], config); 211 | } 212 | }); 213 | 214 | 215 | /* enumerations */ 216 | $('table.fieldtable').removeClass('fieldtable').addClass('table table-striped table-bordered').each(function(){ 217 | $(this).prepend(''); 218 | $(this).find('tbody > tr:first').prependTo($(this).find('thead')); 219 | 220 | $(this).find('td > span.success').parent().addClass('success'); 221 | $(this).find('td > span.warning').parent().addClass('warning'); 222 | $(this).find('td > span.danger').parent().addClass('danger'); 223 | }); 224 | 225 | /* todo list */ 226 | var todoelements = $('.contents > .textblock > dl.reflist > dt, .contents > .textblock > dl.reflist > dd'); 227 | for (var i = 0; i < todoelements.length; i += 2) { 228 | $('.contents > .textblock').append( 229 | '
    ' 230 | + "
    " + $(todoelements[i]).html() + "
    " 231 | + "
    " + $(todoelements[i+1]).html() + "
    " 232 | + '
    '); 233 | } 234 | $('.contents > .textblock > dl').remove(); 235 | 236 | 237 | $(".memitem").removeClass('memitem'); 238 | $(".memproto").removeClass('memproto'); 239 | $(".memdoc").removeClass('memdoc'); 240 | $("span.mlabel").removeClass('mlabel'); 241 | $("table.memberdecls").removeClass('memberdecls'); 242 | $("[class^=memitem]").removeClass('memitem'); 243 | $("span.mlabels").removeClass('mlabels'); 244 | $("table.mlabels").removeClass('mlabels'); 245 | $("td.mlabels-right").removeClass('mlabels-right'); 246 | $(".navpath").removeClass('navpath'); 247 | $("li.navelem").removeClass('navelem'); 248 | $("a.el").removeClass('el'); 249 | $("div.ah").removeClass('ah'); 250 | $("div.header").removeClass("header"); 251 | 252 | $('.mdescLeft').each(function(){ 253 | if($(this).html()==" ") { 254 | $(this).siblings('.mdescRight').attr('colspan', 2); 255 | $(this).remove(); 256 | } 257 | }); 258 | $('td.memItemLeft').each(function(){ 259 | if($(this).siblings('.memItemRight').html()=="") { 260 | $(this).attr('colspan', 2); 261 | $(this).siblings('.memItemRight').remove(); 262 | } 263 | }); 264 | $('td.memTemplItemLeft').each(function(){ 265 | if($(this).siblings('.memTemplItemRight').html()=="") { 266 | $(this).attr('colspan', 2); 267 | $(this).siblings('.memTemplItemRight').remove(); 268 | } 269 | }); 270 | searchBox.CloseResultsWindow(); 271 | }); 272 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017 Jumper Labs LTD. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /doxygen-bootstrapped/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------