Skip to content

Commit e9fe139

Browse files
committed
Merge branch 'master' of https://github.com/mbedmicro/mbed
2 parents a865de9 + 82ff30d commit e9fe139

File tree

136 files changed

+1994
-3478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+1994
-3478
lines changed

README.md

Lines changed: 1 addition & 0 deletions

libraries/USBHost/USBHost/USBHost.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ USB_TYPE USBHost::enumerate(USBDeviceConnected * dev, IUSBEnumerator* pEnumerato
855855
return res;
856856
}
857857

858-
#if DEBUG
858+
#if (DEBUG > 3)
859859
USB_DBG("CONFIGURATION DESCRIPTOR:\r\n");
860860
for (int i = 0; i < total_conf_descr_length; i++)
861861
printf("%02X ", data[i]);

libraries/mbed/common/board.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,41 @@
1919

2020
WEAK void mbed_die(void);
2121
WEAK void mbed_die(void) {
22-
#if defined(DEVICE_ERROR_RED)
22+
__disable_irq(); // dont allow interrupts to disturb the flash pattern
23+
24+
#if (DEVICE_ERROR_RED == 1)
2325
gpio_t led_red; gpio_init(&led_red, LED_RED, PIN_OUTPUT);
2426

25-
#elif defined(DEVICE_ERROR_PATTERN)
27+
#elif (DEVICE_ERROR_PATTERN == 1)
2628
gpio_t led_1; gpio_init(&led_1, LED1, PIN_OUTPUT);
2729
gpio_t led_2; gpio_init(&led_2, LED2, PIN_OUTPUT);
2830
gpio_t led_3; gpio_init(&led_3, LED3, PIN_OUTPUT);
2931
gpio_t led_4; gpio_init(&led_4, LED4, PIN_OUTPUT);
3032
#endif
3133

3234
while (1) {
33-
#if defined(DEVICE_ERROR_RED)
35+
#if (DEVICE_ERROR_RED == 1)
3436
gpio_write(&led_red, 1);
3537

36-
#elif defined(DEVICE_ERROR_PATTERN)
38+
#elif (DEVICE_ERROR_PATTERN == 1)
3739
gpio_write(&led_1, 1);
3840
gpio_write(&led_2, 0);
3941
gpio_write(&led_3, 0);
4042
gpio_write(&led_4, 1);
4143
#endif
44+
4245
wait_ms(150);
4346

44-
#if defined(DEVICE_ERROR_RED)
47+
#if (DEVICE_ERROR_RED == 1)
4548
gpio_write(&led_red, 0);
4649

47-
#elif defined(DEVICE_ERROR_PATTERN)
50+
#elif (DEVICE_ERROR_PATTERN == 1)
4851
gpio_write(&led_1, 0);
4952
gpio_write(&led_2, 1);
5053
gpio_write(&led_3, 1);
5154
gpio_write(&led_4, 0);
5255
#endif
56+
5357
wait_ms(150);
5458
}
5559
}

libraries/mbed/common/retarget.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,22 +398,31 @@ extern "C" WEAK void __cxa_pure_virtual(void) {
398398

399399
// ****************************************************************************
400400
// mbed_main is a function that is called before main()
401+
// mbed_sdk_init() is also a function that is called before main(), but unlike
402+
// mbed_main(), it is not meant for user code, but for the SDK itself to perform
403+
// initializations before main() is called.
401404

402405
extern "C" WEAK void mbed_main(void);
403406
extern "C" WEAK void mbed_main(void) {
404407
}
405408

409+
extern "C" WEAK void mbed_sdk_init(void);
410+
extern "C" WEAK void mbed_sdk_init(void) {
411+
}
412+
406413
#if defined(TOOLCHAIN_ARM)
407414
extern "C" int $Super$$main(void);
408415

409416
extern "C" int $Sub$$main(void) {
417+
mbed_sdk_init();
410418
mbed_main();
411419
return $Super$$main();
412420
}
413421
#elif defined(TOOLCHAIN_GCC)
414422
extern "C" int __real_main(void);
415423

416424
extern "C" int __wrap_main(void) {
425+
mbed_sdk_init();
417426
mbed_main();
418427
return __real_main();
419428
}
@@ -424,6 +433,7 @@ extern "C" int __wrap_main(void) {
424433
// code will call a function to setup argc and argv (__iar_argc_argv) if it is defined.
425434
// Since mbed doesn't use argc/argv, we use this function to call our mbed_main.
426435
extern "C" void __iar_argc_argv() {
436+
mbed_sdk_init();
427437
mbed_main();
428438
}
429439
#endif

0 commit comments

Comments
 (0)