diff --git a/.gitmodules b/.gitmodules
index cce8f7c3..8ee90537 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -9,7 +9,7 @@
url = https://github.com/ThrowTheSwitch/Unity.git
[submodule "hw/mcu/st/stm32lib"]
path = hw/mcu/st/stm32lib
- url = https://github.com/micropython/stm32lib.git
+ url = https://github.com/hathach/stm32lib.git
[submodule "hw/mcu/nxp/lpcopen"]
path = hw/mcu/nxp/lpcopen
url = https://github.com/hathach/lpcopen.git
diff --git a/examples/device/cdc_msc_hid/Makefile b/examples/device/cdc_msc_hid/Makefile
index 4ff3371d..69b633fe 100644
--- a/examples/device/cdc_msc_hid/Makefile
+++ b/examples/device/cdc_msc_hid/Makefile
@@ -9,7 +9,4 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-# Board source
-SRC_C += hw/bsp/$(BOARD)/board_$(BOARD).c
-
include ../../rules.mk
diff --git a/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject b/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject
index 3904cda3..fce8041e 100644
--- a/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject
+++ b/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject
@@ -91,7 +91,6 @@
-
diff --git a/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject b/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject
index a3a59af7..791944a1 100644
--- a/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject
+++ b/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject
@@ -81,7 +81,6 @@
-
diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c
index f743026c..ce81767c 100644
--- a/examples/device/cdc_msc_hid/src/main.c
+++ b/examples/device/cdc_msc_hid/src/main.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/cdc_msc_hid/src/msc_disk.c b/examples/device/cdc_msc_hid/src/msc_disk.c
index ff7cb8d5..ff74ff46 100644
--- a/examples/device/cdc_msc_hid/src/msc_disk.c
+++ b/examples/device/cdc_msc_hid/src/msc_disk.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/cdc_msc_hid/src/tusb_config.h b/examples/device/cdc_msc_hid/src/tusb_config.h
index e909a0d4..8981077d 100644
--- a/examples/device/cdc_msc_hid/src/tusb_config.h
+++ b/examples/device/cdc_msc_hid/src/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,7 +46,9 @@
#endif
#define CFG_TUSB_OS OPT_OS_NONE
-#define CFG_TUSB_DEBUG 2
+
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
diff --git a/examples/device/cdc_msc_hid/src/usb_descriptors.c b/examples/device/cdc_msc_hid/src/usb_descriptors.c
index f887571e..8cd6062b 100644
--- a/examples/device/cdc_msc_hid/src/usb_descriptors.c
+++ b/examples/device/cdc_msc_hid/src/usb_descriptors.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -136,7 +136,7 @@ uint8_t const desc_configuration[] =
#if CFG_TUD_MSC
// Interface number, string index, EP Out & EP In address, EP size
- TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC, 0x80 | EPNUM_MSC, 64), // highspeed 512
+ TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 5, EPNUM_MSC, 0x80 | EPNUM_MSC, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
#endif
#if CFG_TUD_HID
diff --git a/examples/device/cdc_msc_hid_freertos/Makefile b/examples/device/cdc_msc_hid_freertos/Makefile
index 3a39f460..7401f355 100644
--- a/examples/device/cdc_msc_hid_freertos/Makefile
+++ b/examples/device/cdc_msc_hid_freertos/Makefile
@@ -11,9 +11,6 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-# Board source
-SRC_C += hw/bsp/$(BOARD)/board_$(BOARD).c
-
# FreeRTOS source
SRC_C += \
lib/FreeRTOS/Source/list.c \
diff --git a/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c b/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c
index 71bad3dd..474e808a 100644
--- a/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c
+++ b/examples/device/cdc_msc_hid_freertos/src/freertos_hook.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/cdc_msc_hid_freertos/src/main.c b/examples/device/cdc_msc_hid_freertos/src/main.c
index b912c23e..56ea3a7a 100644
--- a/examples/device/cdc_msc_hid_freertos/src/main.c
+++ b/examples/device/cdc_msc_hid_freertos/src/main.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c b/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
index c2a62e03..36c99774 100644
--- a/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
+++ b/examples/device/cdc_msc_hid_freertos/src/msc_disk.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/cdc_msc_hid_freertos/src/tusb_config.h b/examples/device/cdc_msc_hid_freertos/src/tusb_config.h
index c377798c..dfa8be62 100644
--- a/examples/device/cdc_msc_hid_freertos/src/tusb_config.h
+++ b/examples/device/cdc_msc_hid_freertos/src/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,7 +46,9 @@
#endif
#define CFG_TUSB_OS OPT_OS_FREERTOS
-#define CFG_TUSB_DEBUG 2
+
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
diff --git a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c b/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c
index 333d07ba..b60615ca 100644
--- a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c
+++ b/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/hid_generic_inout/Makefile b/examples/device/hid_generic_inout/Makefile
index 4ff3371d..69b633fe 100644
--- a/examples/device/hid_generic_inout/Makefile
+++ b/examples/device/hid_generic_inout/Makefile
@@ -9,7 +9,4 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-# Board source
-SRC_C += hw/bsp/$(BOARD)/board_$(BOARD).c
-
include ../../rules.mk
diff --git a/examples/device/hid_generic_inout/src/main.c b/examples/device/hid_generic_inout/src/main.c
index 650df1ce..d6459867 100644
--- a/examples/device/hid_generic_inout/src/main.c
+++ b/examples/device/hid_generic_inout/src/main.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/hid_generic_inout/src/tusb_config.h b/examples/device/hid_generic_inout/src/tusb_config.h
index baf418d9..acd23f95 100644
--- a/examples/device/hid_generic_inout/src/tusb_config.h
+++ b/examples/device/hid_generic_inout/src/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,7 +46,9 @@
#endif
#define CFG_TUSB_OS OPT_OS_NONE
-#define CFG_TUSB_DEBUG 2
+
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
diff --git a/examples/device/hid_generic_inout/src/usb_descriptors.c b/examples/device/hid_generic_inout/src/usb_descriptors.c
index a9f84b98..28a48754 100644
--- a/examples/device/hid_generic_inout/src/usb_descriptors.c
+++ b/examples/device/hid_generic_inout/src/usb_descriptors.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/msc_dual_lun/Makefile b/examples/device/msc_dual_lun/Makefile
index 59eeacf4..5a455078 100644
--- a/examples/device/msc_dual_lun/Makefile
+++ b/examples/device/msc_dual_lun/Makefile
@@ -9,7 +9,4 @@ INC += \
EXAMPLE_SOURCE += $(wildcard src/*.c)
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
-# Board source
-SRC_C += hw/bsp/$(BOARD)/board_$(BOARD).c
-
include ../../rules.mk
diff --git a/examples/device/msc_dual_lun/src/main.c b/examples/device/msc_dual_lun/src/main.c
index 39a8b472..54cd3d5b 100644
--- a/examples/device/msc_dual_lun/src/main.c
+++ b/examples/device/msc_dual_lun/src/main.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/msc_dual_lun/src/msc_disk_dual.c b/examples/device/msc_dual_lun/src/msc_disk_dual.c
index fd634730..718e0d6e 100644
--- a/examples/device/msc_dual_lun/src/msc_disk_dual.c
+++ b/examples/device/msc_dual_lun/src/msc_disk_dual.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/device/msc_dual_lun/src/tusb_config.h b/examples/device/msc_dual_lun/src/tusb_config.h
index 93991973..fe30fbf2 100644
--- a/examples/device/msc_dual_lun/src/tusb_config.h
+++ b/examples/device/msc_dual_lun/src/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,7 +46,9 @@
#endif
#define CFG_TUSB_OS OPT_OS_NONE
-#define CFG_TUSB_DEBUG 2
+
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
diff --git a/examples/device/msc_dual_lun/src/usb_descriptors.c b/examples/device/msc_dual_lun/src/usb_descriptors.c
index 8cc63da6..24bed9ec 100644
--- a/examples/device/msc_dual_lun/src/usb_descriptors.c
+++ b/examples/device/msc_dual_lun/src/usb_descriptors.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -79,7 +79,7 @@ uint8_t const desc_configuration[] =
TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
// Interface number, string index, EP Out & EP In address, EP size
- TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC, 0x80 | EPNUM_MSC, 64), // highspeed 512
+ TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, EPNUM_MSC, 0x80 | EPNUM_MSC, (CFG_TUSB_RHPORT0_MODE & OPT_MODE_HIGH_SPEED) ? 512 : 64),
};
// Invoked when received GET DEVICE DESCRIPTOR
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index 1c9a5ded..a5e95159 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/host/cdc_msc_hid/src/msc_app.c b/examples/host/cdc_msc_hid/src/msc_app.c
index 00e45109..3001a5f4 100644
--- a/examples/host/cdc_msc_hid/src/msc_app.c
+++ b/examples/host/cdc_msc_hid/src/msc_app.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index aa081f9d..144efa51 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,9 +46,11 @@
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST
#endif
-#define CFG_TUSB_DEBUG 2
#define CFG_TUSB_OS OPT_OS_NONE
+// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
+// #define CFG_TUSB_DEBUG 0
+
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
* Tinyusb use follows macros to declare transferring memory so that they can be put
* into those specific section.
diff --git a/examples/make.mk b/examples/make.mk
index d76f611f..444b2231 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -31,6 +31,9 @@ BUILD = build-$(BOARD)
# Board specific
include $(TOP)/hw/bsp/$(BOARD)/board.mk
+# Include all source C in board folder
+SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)/*.c))
+
# Compiler Flags
CFLAGS += \
-fsingle-precision-constant \
@@ -59,7 +62,7 @@ CFLAGS += \
# Debugging/Optimization
ifeq ($(DEBUG), 1)
- CFLAGS += -O0 -ggdb
+ CFLAGS += -O0 -ggdb -DCFG_TUSB_DEBUG=1
else
CFLAGS += -flto -Os
endif
diff --git a/examples/obsolete/host/src/app_os_prio.h b/examples/obsolete/host/src/app_os_prio.h
index b14c730d..a9e964a7 100644
--- a/examples/obsolete/host/src/app_os_prio.h
+++ b/examples/obsolete/host/src/app_os_prio.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/cdc_serial_host_app.c b/examples/obsolete/host/src/cdc_serial_host_app.c
index 28f7075a..a70ac09b 100644
--- a/examples/obsolete/host/src/cdc_serial_host_app.c
+++ b/examples/obsolete/host/src/cdc_serial_host_app.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/cdc_serial_host_app.h b/examples/obsolete/host/src/cdc_serial_host_app.h
index 2759ecae..0e6bc515 100644
--- a/examples/obsolete/host/src/cdc_serial_host_app.h
+++ b/examples/obsolete/host/src/cdc_serial_host_app.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/keyboard_host_app.c b/examples/obsolete/host/src/keyboard_host_app.c
index e9e3f086..1dc71410 100644
--- a/examples/obsolete/host/src/keyboard_host_app.c
+++ b/examples/obsolete/host/src/keyboard_host_app.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/keyboard_host_app.h b/examples/obsolete/host/src/keyboard_host_app.h
index be87f963..12d7fded 100644
--- a/examples/obsolete/host/src/keyboard_host_app.h
+++ b/examples/obsolete/host/src/keyboard_host_app.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/main.c b/examples/obsolete/host/src/main.c
index e02072b1..59860b78 100644
--- a/examples/obsolete/host/src/main.c
+++ b/examples/obsolete/host/src/main.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/mouse_host_app.c b/examples/obsolete/host/src/mouse_host_app.c
index fa663129..6fd6bcdb 100644
--- a/examples/obsolete/host/src/mouse_host_app.c
+++ b/examples/obsolete/host/src/mouse_host_app.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/mouse_host_app.h b/examples/obsolete/host/src/mouse_host_app.h
index 86abec9a..0193a914 100644
--- a/examples/obsolete/host/src/mouse_host_app.h
+++ b/examples/obsolete/host/src/mouse_host_app.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/msc_cli.c b/examples/obsolete/host/src/msc_cli.c
index f46730f6..c15bcda3 100644
--- a/examples/obsolete/host/src/msc_cli.c
+++ b/examples/obsolete/host/src/msc_cli.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/msc_cli.h b/examples/obsolete/host/src/msc_cli.h
index 0dc55ceb..de90bebd 100644
--- a/examples/obsolete/host/src/msc_cli.h
+++ b/examples/obsolete/host/src/msc_cli.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/msc_host_app.c b/examples/obsolete/host/src/msc_host_app.c
index 9eb97c87..77747b53 100644
--- a/examples/obsolete/host/src/msc_host_app.c
+++ b/examples/obsolete/host/src/msc_host_app.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/msc_host_app.h b/examples/obsolete/host/src/msc_host_app.h
index 59ff81dc..7a160e07 100644
--- a/examples/obsolete/host/src/msc_host_app.h
+++ b/examples/obsolete/host/src/msc_host_app.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/rndis_host_app.c b/examples/obsolete/host/src/rndis_host_app.c
index 9dd8a57a..66da33d0 100644
--- a/examples/obsolete/host/src/rndis_host_app.c
+++ b/examples/obsolete/host/src/rndis_host_app.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/rndis_host_app.h b/examples/obsolete/host/src/rndis_host_app.h
index e7b4abf6..97ff6e27 100644
--- a/examples/obsolete/host/src/rndis_host_app.h
+++ b/examples/obsolete/host/src/rndis_host_app.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/examples/obsolete/host/src/tusb_config.h b/examples/obsolete/host/src/tusb_config.h
index c7dd89e0..d88da4bb 100644
--- a/examples/obsolete/host/src/tusb_config.h
+++ b/examples/obsolete/host/src/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -54,7 +54,7 @@
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
//--------------------------------------------------------------------+
-#define CFG_TUSB_DEBUG 2
+#define CFG_TUSB_DEBUG 1
//#define CFG_TUSB_OS OPT_OS_NONE // defined using eclipse build
//#define CFG_TUD_TASK_PRIO 0 // defined using eclipse build
diff --git a/examples/rules.mk b/examples/rules.mk
index df9ffb7e..d2d5012a 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -22,6 +22,7 @@ INC += $(TOP)/src
#
CFLAGS += $(addprefix -I,$(INC))
LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
+ASFLAGS += $(CFLAGS)
# Assembly files can be name with upper case .S, convert it to .s
SRC_S := $(SRC_S:.S=.s)
@@ -108,4 +109,4 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
@echo r >> $(BUILD)/$(BOARD).jlink
@echo go >> $(BUILD)/$(BOARD).jlink
@echo exit >> $(BUILD)/$(BOARD).jlink
- $(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
+ $(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
diff --git a/hw/bsp/ansi_escape.h b/hw/bsp/ansi_escape.h
index 6310e2b3..35342cfe 100644
--- a/hw/bsp/ansi_escape.h
+++ b/hw/bsp/ansi_escape.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/hw/bsp/board.h b/hw/bsp/board.h
index c78f3708..9e36b990 100644
--- a/hw/bsp/board.h
+++ b/hw/bsp/board.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/hw/bsp/ea4088qs/board.mk b/hw/bsp/ea4088qs/board.mk
new file mode 100644
index 00000000..136984e3
--- /dev/null
+++ b/hw/bsp/ea4088qs/board.mk
@@ -0,0 +1,41 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m4 \
+ -nostdlib \
+ -DCORE_M4 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC40XX \
+ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM2")))' \
+ -D__USE_LPCOPEN
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/ea4088qs/lpc4088.ld
+
+# TODO remove later
+SRC_C += src/portable/$(VENDOR)/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/chip_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/clock_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/gpio_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/iocon_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/sysctl_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/sysinit_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_40xx/src/uart_17xx_40xx.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_40xx/inc
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc17_40
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM3
+
+# For flash-jlink target
+JLINK_DEVICE = LPC4088
+JLINK_IF = swd
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/ea4088qs/board_ea4088qs.c b/hw/bsp/ea4088qs/board_ea4088qs.c
index bccdae0d..4e9f930d 100644
--- a/hw/bsp/ea4088qs/board_ea4088qs.c
+++ b/hw/bsp/ea4088qs/board_ea4088qs.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,9 +30,8 @@
#define LED_PORT 2
#define LED_PIN 19
-//--------------------------------------------------------------------+
-// MACRO TYPEDEF CONSTANT ENUM DECLARATION
-//--------------------------------------------------------------------+
+#define BUTTON_PORT 2
+#define BUTTON_PIN 10
/* System oscillator rate and RTC oscillator rate */
const uint32_t OscRateIn = 12000000;
@@ -41,8 +40,11 @@ const uint32_t RTCOscRateIn = 32768;
/* Pin muxing configuration */
static const PINMUX_GRP_T pinmuxing[] =
{
- /* LEDs */
+ // LED
{2, 19, (IOCON_FUNC0 | IOCON_MODE_INACT)},
+
+ // Button
+ {2, 10, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_MODE_PULLUP)},
};
static const PINMUX_GRP_T pin_usb_mux[] =
@@ -67,7 +69,7 @@ static const PINMUX_GRP_T pin_usb_mux[] =
// Invoked by startup code
void SystemInit(void)
{
- /* Enable IOCON clock */
+ Chip_IOCON_Init(LPC_IOCON);
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
Chip_SetupXtalClocking();
}
@@ -86,16 +88,17 @@ void board_init(void)
Chip_GPIO_Init(LPC_GPIO);
- //------------- LED -------------//
+ // LED
Chip_GPIO_SetPinDIROutput(LPC_GPIO, LED_PORT, LED_PIN);
- //------------- BUTTON -------------//
-// for(uint8_t i=0; iStCtrl = 0x3;
-
- Chip_IOCON_SetPinMuxing(LPC_IOCON, pin_usb_mux, sizeof(pin_usb_mux) / sizeof(PINMUX_GRP_T));
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
-//------------- LED -------------//
void board_led_write(bool state)
{
Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state);
}
-//------------- Buttons -------------//
-#if 0
-static bool button_read(uint8_t id)
-{
-// return !TU_BIT_TEST( GPIO_ReadValue(buttons[id].gpio_port), buttons[id].gpio_pin ); // button is active low
-}
-#endif
-
uint32_t board_button_read(void)
{
- uint32_t result = 0;
-
-// for(uint8_t i=0; iVTOR =
+ *pSCB_VTOR = (unsigned int)g_pfnVectors;
+ }
+
+#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{ while(1) {}
+}
+
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{ while(1) {}
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{ while(1) {}
+}
diff --git a/hw/bsp/ea4088qs/lpc4088.ld b/hw/bsp/ea4088qs/lpc4088.ld
new file mode 100644
index 00000000..4b1cddd6
--- /dev/null
+++ b/hw/bsp/ea4088qs/lpc4088.ld
@@ -0,0 +1,184 @@
+/*
+ * GENERATED FILE - DO NOT EDIT
+ * (c) Code Red Technologies Ltd, 2008-2013
+ * (c) NXP Semiconductors 2013-2019
+ * Generated linker script file for LPC4088
+ * Created from linkscript.ldt by FMCreateLinkLibraries
+ * Using Freemarker v2.3.23
+ * MCUXpresso IDE v10.2.1 [Build 795] [2018-07-25] on May 15, 2019 5:16:07 PM
+ */
+
+MEMORY
+{
+ /* Define each memory region */
+ MFlash512 (rx) : ORIGIN = 0x0, LENGTH = 0x80000 /* 512K bytes (alias Flash) */
+ RamLoc64 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x10000 /* 64K bytes (alias RAM) */
+ RamPeriph32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes (alias RAM2) */
+}
+
+ /* Define a symbol for the top of each memory region */
+ __base_MFlash512 = 0x0 ; /* MFlash512 */
+ __base_Flash = 0x0 ; /* Flash */
+ __top_MFlash512 = 0x0 + 0x80000 ; /* 512K bytes */
+ __top_Flash = 0x0 + 0x80000 ; /* 512K bytes */
+ __base_RamLoc64 = 0x10000000 ; /* RamLoc64 */
+ __base_RAM = 0x10000000 ; /* RAM */
+ __top_RamLoc64 = 0x10000000 + 0x10000 ; /* 64K bytes */
+ __top_RAM = 0x10000000 + 0x10000 ; /* 64K bytes */
+ __base_RamPeriph32 = 0x20000000 ; /* RamPeriph32 */
+ __base_RAM2 = 0x20000000 ; /* RAM2 */
+ __top_RamPeriph32 = 0x20000000 + 0x8000 ; /* 32K bytes */
+ __top_RAM2 = 0x20000000 + 0x8000 ; /* 32K bytes */
+
+ENTRY(ResetISR)
+
+SECTIONS
+{
+ /* MAIN TEXT SECTION */
+ .text : ALIGN(4)
+ {
+ FILL(0xff)
+ __vectors_start__ = ABSOLUTE(.) ;
+ KEEP(*(.isr_vector))
+ /* Global Section Table */
+ . = ALIGN(4) ;
+ __section_table_start = .;
+ __data_section_table = .;
+ LONG(LOADADDR(.data));
+ LONG( ADDR(.data));
+ LONG( SIZEOF(.data));
+ LONG(LOADADDR(.data_RAM2));
+ LONG( ADDR(.data_RAM2));
+ LONG( SIZEOF(.data_RAM2));
+ __data_section_table_end = .;
+ __bss_section_table = .;
+ LONG( ADDR(.bss));
+ LONG( SIZEOF(.bss));
+ LONG( ADDR(.bss_RAM2));
+ LONG( SIZEOF(.bss_RAM2));
+ __bss_section_table_end = .;
+ __section_table_end = . ;
+ /* End of Global Section Table */
+
+ *(.after_vectors*)
+
+ } > MFlash512
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlash512
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlash512
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlash512
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* DATA section for RamPeriph32 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$RamPeriph32)
+ *(.data.$RAM2*)
+ *(.data.$RamPeriph32*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > RamPeriph32 AT>MFlash512
+ /* MAIN DATA SECTION */
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > RamLoc64
+
+ /* Main DATA section (RamLoc64) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > RamLoc64 AT>MFlash512
+
+ /* BSS section for RamPeriph32 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$RamPeriph32*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > RamPeriph32
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > RamLoc64
+
+ /* NOINIT section for RamPeriph32 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$RamPeriph32*)
+ . = ALIGN(4) ;
+ } > RamPeriph32
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > RamLoc64
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc64 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (NMI_Handler + 1)
+ + (HardFault_Handler + 1)
+ + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
+ + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
+ + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
+ ) );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+}
\ No newline at end of file
diff --git a/hw/bsp/ea4357/board.mk b/hw/bsp/ea4357/board.mk
new file mode 100644
index 00000000..a44d20f9
--- /dev/null
+++ b/hw/bsp/ea4357/board.mk
@@ -0,0 +1,41 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m4 \
+ -nostdlib \
+ -DCORE_M4 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC43XX \
+ -D__USE_LPCOPEN
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/ea4357/lpc4357.ld
+
+# TODO remove later
+SRC_C += src/portable/$(VENDOR)/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/chip_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/clock_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/gpio_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/sysinit_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/i2c_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/i2cm_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_43xx/src/uart_18xx_43xx.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_43xx/inc \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_43xx/inc/config_43xx
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc18_43
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM4
+
+# For flash-jlink target
+JLINK_DEVICE = LPC4357
+JLINK_IF = jtag
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/ea4357/board_ea4357.c b/hw/bsp/ea4357/board_ea4357.c
index f6287cd0..2164d3e0 100644
--- a/hw/bsp/ea4357/board_ea4357.c
+++ b/hw/bsp/ea4357/board_ea4357.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -33,55 +33,40 @@
#define BOARD_UART_PIN_TX 10 // PF.10 : UART0_TXD
#define BOARD_UART_PIN_RX 11 // PF.11 : UART0_RXD
-static const struct {
- uint8_t mux_port;
- uint8_t mux_pin;
+// P9_1 joystick down
+#define BUTTON_PORT 4
+#define BUTTON_PIN 13
- uint8_t gpio_port;
- uint8_t gpio_pin;
-}buttons[] =
-{
- {0x0a, 3, 4, 10 }, // Joystick up
- {0x09, 1, 4, 13 }, // Joystick down
- {0x0a, 2, 4, 9 }, // Joystick left
- {0x09, 0, 4, 12 }, // Joystick right
- {0x0a, 1, 4, 8 }, // Joystick press
- {0x02, 7, 0, 7 }, // SW6
-};
-enum {
- BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
-};
-
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
-#if CFG_TUSB_OS == OPT_OS_NONE
-
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
-uint32_t board_millis(void)
-{
- return system_ticks;
-}
-
-#endif
+//static const struct {
+// uint8_t mux_port;
+// uint8_t mux_pin;
+//
+// uint8_t gpio_port;
+// uint8_t gpio_pin;
+//}buttons[] =
+//{
+// {0x0a, 3, 4, 10 }, // Joystick up
+// {0x09, 1, 4, 13 }, // Joystick down
+// {0x0a, 2, 4, 9 }, // Joystick left
+// {0x09, 0, 4, 12 }, // Joystick right
+// {0x0a, 1, 4, 8 }, // Joystick press
+// {0x02, 7, 0, 7 }, // SW6
+//};
/*------------------------------------------------------------------*/
/* BOARD API
*------------------------------------------------------------------*/
/* System configuration variables used by chip driver */
-const uint32_t ExtRateIn = 0;
const uint32_t OscRateIn = 12000000;
+const uint32_t ExtRateIn = 0;
static const PINMUX_GRP_T pinmuxing[] =
{
+ // Button
+ {0x9, 1, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLUP)},
+
// USB
/* I2S */
@@ -124,12 +109,14 @@ void board_init(void)
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
+ //NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
Chip_GPIO_Init(LPC_GPIO_PORT);
- //------------- LED -------------//
- /* Init I2C */
+ // LED via pca9532 I2C
Chip_SCU_I2C0PinConfig(I2C0_STANDARD_FAST_MODE);
Chip_I2C_Init(I2C0);
Chip_I2C_SetClockRate(I2C0, 100000);
@@ -137,14 +124,10 @@ void board_init(void)
pca9532_init();
-#if 0
- //------------- BUTTON -------------//
- for(uint8_t i=0; iRESET_CTRL0 @ 0x40053100
+ // LPC_RGU->RESET_CTRL1 @ 0x40053104
+ // Note that we do not use the CMSIS register access mechanism,
+ // as there is no guarantee that the project has been configured
+ // to use CMSIS.
+
+ // Write to LPC_RGU->RESET_CTRL0
+ *(RESET_CONTROL + 0) = 0x10DF1000;
+ // GPIO_RST|AES_RST|ETHERNET_RST|SDIO_RST|DMA_RST|
+ // USB1_RST|USB0_RST|LCD_RST|M0_SUB_RST
+
+ // Write to LPC_RGU->RESET_CTRL1
+ *(RESET_CONTROL + 1) = 0x01DFF7FF;
+ // M0APP_RST|CAN0_RST|CAN1_RST|I2S_RST|SSP1_RST|SSP0_RST|
+ // I2C1_RST|I2C0_RST|UART3_RST|UART1_RST|UART1_RST|UART0_RST|
+ // DAC_RST|ADC1_RST|ADC0_RST|QEI_RST|MOTOCONPWM_RST|SCT_RST|
+ // RITIMER_RST|TIMER3_RST|TIMER2_RST|TIMER1_RST|TIMER0_RST
+
+ // Clear all pending interrupts in the NVIC
+ volatile unsigned int *NVIC_ICPR = (unsigned int *) 0xE000E280;
+ unsigned int irqpendloop;
+ for (irqpendloop = 0; irqpendloop < 8; irqpendloop++) {
+ *(NVIC_ICPR + irqpendloop) = 0xFFFFFFFF;
+ }
+
+ // Reenable interrupts
+ __asm volatile ("cpsie i");
+ // equivalent to CMSIS '__enable_irq()' function
+
+#endif // ifndef DONT_RESET_ON_RESTART
+// *************************************************************
+
+#if defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+
+#if !defined (__USE_LPCOPEN)
+// LPCOpen init code deals with FP and VTOR initialisation
+#if defined (__VFP_FP__) && !defined (__SOFTFP__)
+ /*
+ * Code to enable the Cortex-M4 FPU only included
+ * if appropriate build options have been selected.
+ * Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C)
+ */
+ // CPACR is located at address 0xE000ED88
+ asm("LDR.W R0, =0xE000ED88");
+ // Read CPACR
+ asm("LDR R1, [R0]");
+ // Set bits 20-23 to enable CP10 and CP11 coprocessors
+ asm(" ORR R1, R1, #(0xF << 20)");
+ // Write back the modified value to the CPACR
+ asm("STR R1, [R0]");
+#endif // (__VFP_FP__) && !(__SOFTFP__)
+ // ******************************
+ // Check to see if we are running the code from a non-zero
+ // address (eg RAM, external flash), in which case we need
+ // to modify the VTOR register to tell the CPU that the
+ // vector table is located at a non-0x0 address.
+
+ // Note that we do not use the CMSIS register access mechanism,
+ // as there is no guarantee that the project has been configured
+ // to use CMSIS.
+ unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
+ if ((unsigned int *) g_pfnVectors != (unsigned int *) 0x00000000) {
+ // CMSIS : SCB->VTOR =
+ *pSCB_VTOR = (unsigned int) g_pfnVectors;
+ }
+#endif
+
+#if defined (__USE_CMSIS)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main();
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void) {
+ while (1) {
+ }
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void) {
+ while (1) {
+ }
+}
+
+
+
+
+
+
diff --git a/hw/bsp/ea4357/lpc4357.ld b/hw/bsp/ea4357/lpc4357.ld
new file mode 100644
index 00000000..14a0df32
--- /dev/null
+++ b/hw/bsp/ea4357/lpc4357.ld
@@ -0,0 +1,324 @@
+/*
+ * GENERATED FILE - DO NOT EDIT
+ * (c) Code Red Technologies Ltd, 2008-2013
+ * (c) NXP Semiconductors 2013-2019
+ * Generated linker script file for LPC4357
+ * Created from linkscript.ldt by FMCreateLinkLibraries
+ * Using Freemarker v2.3.23
+ * MCUXpresso IDE v10.2.1 [Build 795] [2018-07-25] on May 15, 2019 5:48:43 PM
+ */
+
+MEMORY
+{
+ /* Define each memory region */
+ MFlashA512 (rx) : ORIGIN = 0x1a000000, LENGTH = 0x80000 /* 512K bytes (alias Flash) */
+ MFlashB512 (rx) : ORIGIN = 0x1b000000, LENGTH = 0x80000 /* 512K bytes (alias Flash2) */
+ RamLoc32 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000 /* 32K bytes (alias RAM) */
+ RamLoc40 (rwx) : ORIGIN = 0x10080000, LENGTH = 0xa000 /* 40K bytes (alias RAM2) */
+ RamAHB32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes (alias RAM3) */
+ RamAHB16 (rwx) : ORIGIN = 0x20008000, LENGTH = 0x4000 /* 16K bytes (alias RAM4) */
+ RamAHB_ETB16 (rwx) : ORIGIN = 0x2000c000, LENGTH = 0x4000 /* 16K bytes (alias RAM5) */
+}
+
+ /* Define a symbol for the top of each memory region */
+ __base_MFlashA512 = 0x1a000000 ; /* MFlashA512 */
+ __base_Flash = 0x1a000000 ; /* Flash */
+ __top_MFlashA512 = 0x1a000000 + 0x80000 ; /* 512K bytes */
+ __top_Flash = 0x1a000000 + 0x80000 ; /* 512K bytes */
+ __base_MFlashB512 = 0x1b000000 ; /* MFlashB512 */
+ __base_Flash2 = 0x1b000000 ; /* Flash2 */
+ __top_MFlashB512 = 0x1b000000 + 0x80000 ; /* 512K bytes */
+ __top_Flash2 = 0x1b000000 + 0x80000 ; /* 512K bytes */
+ __base_RamLoc32 = 0x10000000 ; /* RamLoc32 */
+ __base_RAM = 0x10000000 ; /* RAM */
+ __top_RamLoc32 = 0x10000000 + 0x8000 ; /* 32K bytes */
+ __top_RAM = 0x10000000 + 0x8000 ; /* 32K bytes */
+ __base_RamLoc40 = 0x10080000 ; /* RamLoc40 */
+ __base_RAM2 = 0x10080000 ; /* RAM2 */
+ __top_RamLoc40 = 0x10080000 + 0xa000 ; /* 40K bytes */
+ __top_RAM2 = 0x10080000 + 0xa000 ; /* 40K bytes */
+ __base_RamAHB32 = 0x20000000 ; /* RamAHB32 */
+ __base_RAM3 = 0x20000000 ; /* RAM3 */
+ __top_RamAHB32 = 0x20000000 + 0x8000 ; /* 32K bytes */
+ __top_RAM3 = 0x20000000 + 0x8000 ; /* 32K bytes */
+ __base_RamAHB16 = 0x20008000 ; /* RamAHB16 */
+ __base_RAM4 = 0x20008000 ; /* RAM4 */
+ __top_RamAHB16 = 0x20008000 + 0x4000 ; /* 16K bytes */
+ __top_RAM4 = 0x20008000 + 0x4000 ; /* 16K bytes */
+ __base_RamAHB_ETB16 = 0x2000c000 ; /* RamAHB_ETB16 */
+ __base_RAM5 = 0x2000c000 ; /* RAM5 */
+ __top_RamAHB_ETB16 = 0x2000c000 + 0x4000 ; /* 16K bytes */
+ __top_RAM5 = 0x2000c000 + 0x4000 ; /* 16K bytes */
+
+
+ENTRY(ResetISR)
+
+SECTIONS
+{
+ .text_Flash2 : ALIGN(4)
+ {
+ FILL(0xff)
+ *(.text_Flash2*) /* for compatibility with previous releases */
+ *(.text_MFlashB512*) /* for compatibility with previous releases */
+ *(.text.$Flash2*)
+ *(.text.$MFlashB512*)
+ *(.rodata.$Flash2*)
+ *(.rodata.$MFlashB512*)
+ } > MFlashB512
+
+ /* MAIN TEXT SECTION */
+ .text : ALIGN(4)
+ {
+ FILL(0xff)
+ __vectors_start__ = ABSOLUTE(.) ;
+ KEEP(*(.isr_vector))
+ /* Global Section Table */
+ . = ALIGN(4) ;
+ __section_table_start = .;
+ __data_section_table = .;
+ LONG(LOADADDR(.data));
+ LONG( ADDR(.data));
+ LONG( SIZEOF(.data));
+ LONG(LOADADDR(.data_RAM2));
+ LONG( ADDR(.data_RAM2));
+ LONG( SIZEOF(.data_RAM2));
+ LONG(LOADADDR(.data_RAM3));
+ LONG( ADDR(.data_RAM3));
+ LONG( SIZEOF(.data_RAM3));
+ LONG(LOADADDR(.data_RAM4));
+ LONG( ADDR(.data_RAM4));
+ LONG( SIZEOF(.data_RAM4));
+ LONG(LOADADDR(.data_RAM5));
+ LONG( ADDR(.data_RAM5));
+ LONG( SIZEOF(.data_RAM5));
+ __data_section_table_end = .;
+ __bss_section_table = .;
+ LONG( ADDR(.bss));
+ LONG( SIZEOF(.bss));
+ LONG( ADDR(.bss_RAM2));
+ LONG( SIZEOF(.bss_RAM2));
+ LONG( ADDR(.bss_RAM3));
+ LONG( SIZEOF(.bss_RAM3));
+ LONG( ADDR(.bss_RAM4));
+ LONG( SIZEOF(.bss_RAM4));
+ LONG( ADDR(.bss_RAM5));
+ LONG( SIZEOF(.bss_RAM5));
+ __bss_section_table_end = .;
+ __section_table_end = . ;
+ /* End of Global Section Table */
+
+ *(.after_vectors*)
+
+ } > MFlashA512
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlashA512
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlashA512
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlashA512
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* DATA section for RamLoc40 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$RamLoc40)
+ *(.data.$RAM2*)
+ *(.data.$RamLoc40*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > RamLoc40 AT>MFlashA512
+ /* DATA section for RamAHB32 */
+
+ .data_RAM3 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM3 = .) ;
+ *(.ramfunc.$RAM3)
+ *(.ramfunc.$RamAHB32)
+ *(.data.$RAM3*)
+ *(.data.$RamAHB32*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM3 = .) ;
+ } > RamAHB32 AT>MFlashA512
+ /* DATA section for RamAHB16 */
+
+ .data_RAM4 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM4 = .) ;
+ *(.ramfunc.$RAM4)
+ *(.ramfunc.$RamAHB16)
+ *(.data.$RAM4*)
+ *(.data.$RamAHB16*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM4 = .) ;
+ } > RamAHB16 AT>MFlashA512
+ /* DATA section for RamAHB_ETB16 */
+
+ .data_RAM5 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM5 = .) ;
+ *(.ramfunc.$RAM5)
+ *(.ramfunc.$RamAHB_ETB16)
+ *(.data.$RAM5*)
+ *(.data.$RamAHB_ETB16*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM5 = .) ;
+ } > RamAHB_ETB16 AT>MFlashA512
+ /* MAIN DATA SECTION */
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > RamLoc32
+
+ /* Main DATA section (RamLoc32) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > RamLoc32 AT>MFlashA512
+
+ /* BSS section for RamLoc40 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$RamLoc40*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > RamLoc40
+
+ /* BSS section for RamAHB32 */
+ .bss_RAM3 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM3 = .) ;
+ *(.bss.$RAM3*)
+ *(.bss.$RamAHB32*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM3 = .) ;
+ } > RamAHB32
+
+ /* BSS section for RamAHB16 */
+ .bss_RAM4 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM4 = .) ;
+ *(.bss.$RAM4*)
+ *(.bss.$RamAHB16*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM4 = .) ;
+ } > RamAHB16
+
+ /* BSS section for RamAHB_ETB16 */
+ .bss_RAM5 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM5 = .) ;
+ *(.bss.$RAM5*)
+ *(.bss.$RamAHB_ETB16*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM5 = .) ;
+ } > RamAHB_ETB16
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > RamLoc32
+
+ /* NOINIT section for RamLoc40 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$RamLoc40*)
+ . = ALIGN(4) ;
+ } > RamLoc40
+
+ /* NOINIT section for RamAHB32 */
+ .noinit_RAM3 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM3*)
+ *(.noinit.$RamAHB32*)
+ . = ALIGN(4) ;
+ } > RamAHB32
+
+ /* NOINIT section for RamAHB16 */
+ .noinit_RAM4 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM4*)
+ *(.noinit.$RamAHB16*)
+ . = ALIGN(4) ;
+ } > RamAHB16
+
+ /* NOINIT section for RamAHB_ETB16 */
+ .noinit_RAM5 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM5*)
+ *(.noinit.$RamAHB_ETB16*)
+ . = ALIGN(4) ;
+ } > RamAHB_ETB16
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > RamLoc32
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (NMI_Handler + 1)
+ + (HardFault_Handler + 1)
+ + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
+ + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
+ + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
+ ) );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+}
\ No newline at end of file
diff --git a/hw/bsp/feather_nrf52840_express/board.mk b/hw/bsp/feather_nrf52840_express/board.mk
index 317a4969..7462cf62 100644
--- a/hw/bsp/feather_nrf52840_express/board.mk
+++ b/hw/bsp/feather_nrf52840_express/board.mk
@@ -35,9 +35,6 @@ INC += \
SRC_S += hw/mcu/nordic/nrfx/mdk/gcc_startup_nrf52840.S
ASFLAGS += -D__HEAP_SIZE=0
-ASFLAGS += -DSWI_DISABLE0
-ASFLAGS += -DFLOAT_ABI_HARD
-ASFLAGS += -DNRF52840_XXAA
# For TinyUSB port source
VENDOR = nordic
diff --git a/hw/bsp/feather_nrf52840_express/board_feather_nrf52840_express.c b/hw/bsp/feather_nrf52840_express/board_feather_nrf52840_express.c
index aed869af..034dab28 100644
--- a/hw/bsp/feather_nrf52840_express/board_feather_nrf52840_express.c
+++ b/hw/bsp/feather_nrf52840_express/board_feather_nrf52840_express.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,28 +46,6 @@
#define BUTTON_PIN _PINNUM(1, 02)
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
-#if CFG_TUSB_OS == OPT_OS_NONE
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
-uint32_t board_millis(void)
-{
- return system_ticks;
-}
-
-#endif
-
-/*------------------------------------------------------------------*/
-/* BOARD API
- *------------------------------------------------------------------*/
-
// tinyusb function that handles power event (detected, ready, removed)
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
extern void tusb_hal_nrf_power_event(uint32_t event);
@@ -128,6 +106,10 @@ void board_init(void)
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
+
void board_led_write(bool state)
{
nrf_gpio_pin_write(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
@@ -153,6 +135,19 @@ int board_uart_write(void const * buf, int len)
return 0;
}
+#if CFG_TUSB_OS == OPT_OS_NONE
+volatile uint32_t system_ticks = 0;
+void SysTick_Handler (void)
+{
+ system_ticks++;
+}
+
+uint32_t board_millis(void)
+{
+ return system_ticks;
+}
+#endif
+
#ifdef SOFTDEVICE_PRESENT
// process SOC event from SD
uint32_t proc_soc(void)
diff --git a/hw/bsp/lpcxpresso11u68/board.mk b/hw/bsp/lpcxpresso11u68/board.mk
new file mode 100644
index 00000000..70c349a4
--- /dev/null
+++ b/hw/bsp/lpcxpresso11u68/board.mk
@@ -0,0 +1,39 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m0plus \
+ -nostdlib \
+ -DCORE_M0PLUS \
+ -D__VTOR_PRESENT=0 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC11UXX \
+ -D__USE_LPCOPEN \
+ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \
+ -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/lpcxpresso11u68/lpc11u68.ld
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_11u6x/src/chip_11u6x.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_11u6x/src/clock_11u6x.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_11u6x/src/gpio_11u6x.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_11u6x/src/iocon_11u6x.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_11u6x/src/syscon_11u6x.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_11u6x/src/sysinit_11u6x.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_11u6x/inc
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc11_13_15
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM0
+
+# For flash-jlink target
+JLINK_DEVICE = LPC11U68
+JLINK_IF = swd
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
index b491a040..7f226620 100644
--- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
+++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -31,14 +31,8 @@
#define LED_PIN 17
#define LED_STATE_ON 0
-static const struct {
- uint8_t port;
- uint8_t pin;
-} buttons[] = { { 0, 1 } };
-
-enum {
- BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
-};
+#define BUTTON_PORT 0
+#define BUTTON_PIN 1
/* System oscillator rate and RTC oscillator rate */
const uint32_t OscRateIn = 12000000;
@@ -78,26 +72,47 @@ void board_init(void)
Chip_GPIO_Init(LPC_GPIO);
- //------------- LED -------------//
+ // LED
Chip_GPIO_SetPinDIROutput(LPC_GPIO, LED_PORT, LED_PIN);
- //------------- BUTTON -------------//
- //for(uint8_t i=0; i MFlash256
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlash256
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlash256
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlash256
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* possible MTB section for Ram1_2 */
+ .mtb_buffer_RAM2 (NOLOAD) :
+ {
+ KEEP(*(.mtb.$RAM2*))
+ KEEP(*(.mtb.$Ram1_2*))
+ } > Ram1_2
+
+ /* DATA section for Ram1_2 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$Ram1_2)
+ *(.data.$RAM2*)
+ *(.data.$Ram1_2*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > Ram1_2 AT>MFlash256
+ /* possible MTB section for Ram2USB_2 */
+ .mtb_buffer_RAM3 (NOLOAD) :
+ {
+ KEEP(*(.mtb.$RAM3*))
+ KEEP(*(.mtb.$Ram2USB_2*))
+ } > Ram2USB_2
+
+ /* DATA section for Ram2USB_2 */
+
+ .data_RAM3 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM3 = .) ;
+ *(.ramfunc.$RAM3)
+ *(.ramfunc.$Ram2USB_2)
+ *(.data.$RAM3*)
+ *(.data.$Ram2USB_2*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM3 = .) ;
+ } > Ram2USB_2 AT>MFlash256
+ /* MAIN DATA SECTION */
+ /* Default MTB section */
+ .mtb_buffer_default (NOLOAD) :
+ {
+ KEEP(*(.mtb*))
+ } > Ram0_32
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > Ram0_32
+
+ /* Main DATA section (Ram0_32) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > Ram0_32 AT>MFlash256
+
+ /* BSS section for Ram1_2 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$Ram1_2*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > Ram1_2
+
+ /* BSS section for Ram2USB_2 */
+ .bss_RAM3 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM3 = .) ;
+ *(.bss.$RAM3*)
+ *(.bss.$Ram2USB_2*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM3 = .) ;
+ } > Ram2USB_2
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > Ram0_32
+
+ /* NOINIT section for Ram1_2 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$Ram1_2*)
+ . = ALIGN(4) ;
+ } > Ram1_2
+
+ /* NOINIT section for Ram2USB_2 */
+ .noinit_RAM3 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM3*)
+ *(.noinit.$Ram2USB_2*)
+ . = ALIGN(4) ;
+ } > Ram2USB_2
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > Ram0_32
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_Ram0_32 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (( DEFINED(NMI_Handler) ? NMI_Handler : M0_NMI_Handler ) + 1)
+ + (( DEFINED(HardFault_Handler) ? HardFault_Handler : M0_HardFault_Handler ) + 1)
+ )
+ );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+}
\ No newline at end of file
diff --git a/hw/bsp/lpcxpresso1347/board.mk b/hw/bsp/lpcxpresso1347/board.mk
new file mode 100644
index 00000000..e87c4e7d
--- /dev/null
+++ b/hw/bsp/lpcxpresso1347/board.mk
@@ -0,0 +1,38 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m3 \
+ -nostdlib \
+ -DCORE_M3 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC13XX \
+ -D__USE_LPCOPEN \
+ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \
+ -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/lpcxpresso1347/lpc1347.ld
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/chip_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/clock_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/gpio_13xx_1.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/iocon_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/sysctl_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/sysinit_13xx.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_13xx/inc
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc11_13_15
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM3
+
+# For flash-jlink target
+JLINK_DEVICE = LPC1347
+JLINK_IF = swd
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
index e916ad97..d389eb79 100644
--- a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
+++ b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,26 +27,25 @@
#include "chip.h"
#include "../board.h"
-#define LED_PORT 0
-#define LED_PIN 7
+#define LED_PORT 0
+#define LED_PIN 7
-static const struct {
- uint8_t port;
- uint8_t pin;
-} buttons[] =
-{
- {1, 22 }, // Joystick up
- {1, 20 }, // Joystick down
- {1, 23 }, // Joystick left
- {1, 21 }, // Joystick right
- {1, 19 }, // Joystick press
- {0, 1 }, // SW3
-// {1, 4 }, // SW4 (require to remove J28)
-};
+// Joytick Down if connected to LPCXpresso Base board
+#define BUTTON_PORT 1
+#define BUTTON_PIN 20
-enum {
- BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
-};
+//static const struct {
+// uint8_t port;
+// uint8_t pin;
+//} buttons[] =
+//{
+// {1, 22 }, // Joystick up
+// {1, 20 }, // Joystick down
+// {1, 23 }, // Joystick left
+// {1, 21 }, // Joystick right
+// {1, 19 }, // Joystick press
+// {0, 1 }, // SW3
+//};
/* System oscillator rate and RTC oscillator rate */
const uint32_t OscRateIn = 12000000;
@@ -91,26 +90,22 @@ void board_init(void)
Chip_GPIO_Init(LPC_GPIO_PORT);
- //------------- LED -------------//
+ // LED
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED_PORT, LED_PIN);
- //------------- BUTTON -------------//
-// for(uint8_t i=0; i MFlash64
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlash64
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlash64
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlash64
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* DATA section for RamUsb2 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$RamUsb2)
+ *(.data.$RAM2*)
+ *(.data.$RamUsb2*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > RamUsb2 AT>MFlash64
+ /* DATA section for RamPeriph2 */
+
+ .data_RAM3 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM3 = .) ;
+ *(.ramfunc.$RAM3)
+ *(.ramfunc.$RamPeriph2)
+ *(.data.$RAM3*)
+ *(.data.$RamPeriph2*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM3 = .) ;
+ } > RamPeriph2 AT>MFlash64
+ /* MAIN DATA SECTION */
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > RamLoc8
+
+ /* Main DATA section (RamLoc8) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > RamLoc8 AT>MFlash64
+
+ /* BSS section for RamUsb2 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$RamUsb2*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > RamUsb2
+
+ /* BSS section for RamPeriph2 */
+ .bss_RAM3 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM3 = .) ;
+ *(.bss.$RAM3*)
+ *(.bss.$RamPeriph2*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM3 = .) ;
+ } > RamPeriph2
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > RamLoc8
+
+ /* NOINIT section for RamUsb2 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$RamUsb2*)
+ . = ALIGN(4) ;
+ } > RamUsb2
+
+ /* NOINIT section for RamPeriph2 */
+ .noinit_RAM3 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM3*)
+ *(.noinit.$RamPeriph2*)
+ . = ALIGN(4) ;
+ } > RamPeriph2
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > RamLoc8
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc8 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (NMI_Handler + 1)
+ + (HardFault_Handler + 1)
+ + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
+ + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
+ + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
+ ) );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+}
\ No newline at end of file
diff --git a/hw/bsp/lpcxpresso1769/board.mk b/hw/bsp/lpcxpresso1769/board.mk
new file mode 100644
index 00000000..1885ae90
--- /dev/null
+++ b/hw/bsp/lpcxpresso1769/board.mk
@@ -0,0 +1,41 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m3 \
+ -nostdlib \
+ -DCORE_M3 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC175X_6X \
+ -D__USE_LPCOPEN \
+ -DRTC_EV_SUPPORT=0
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/lpcxpresso1769/lpc1769.ld
+
+# TODO remove later
+SRC_C += src/portable/$(VENDOR)/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/chip_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/clock_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/gpio_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/iocon_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/sysctl_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/sysinit_17xx_40xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/src/uart_17xx_40xx.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_175x_6x/inc
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc17_40
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM3
+
+# For flash-jlink target
+JLINK_DEVICE = LPC1769
+JLINK_IF = swd
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
index 06b6a243..d0a87c0d 100644
--- a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
+++ b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,10 @@
#define LED_PORT 0
#define LED_PIN 22
+// Joytick Down if connected to LPCXpresso Base board
+#define BUTTON_PORT 0
+#define BUTTON_PIN 15
+
#define BOARD_UART_PORT LPC_UART3
/* System oscillator rate and RTC oscillator rate */
@@ -60,18 +64,14 @@ static const PINMUX_GRP_T pin_usb_mux[] =
{1, 19, IOCON_MODE_INACT | IOCON_FUNC2}, // USB_PPWR
{1, 22, IOCON_MODE_INACT | IOCON_FUNC2}, // USB_PWRD
- /* VBUS is not connected on this board, so leave the pin at default setting. */
- /*Chip_IOCON_PinMux(LPC_IOCON, 1, 30, IOCON_MODE_INACT, IOCON_FUNC2);*/ /* USB VBUS */
-};
-
-enum {
- BOARD_BUTTON_COUNT = 5
+ /* VBUS is not connected on this board, so leave the pin at default setting. */
+ /*Chip_IOCON_PinMux(LPC_IOCON, 1, 30, IOCON_MODE_INACT, IOCON_FUNC2);*/ /* USB VBUS */
};
// Invoked by startup code
void SystemInit(void)
{
- /* Enable IOCON clock */
+ Chip_IOCON_Init(LPC_IOCON);
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
Chip_SetupXtalClocking();
}
@@ -90,11 +90,11 @@ void board_init(void)
Chip_GPIO_Init(LPC_GPIO);
- //------------- LED -------------//
+ // LED
Chip_GPIO_SetPinDIROutput(LPC_GPIO, LED_PORT, LED_PIN);
- //------------- BUTTON -------------//
-// for(uint8_t i=0; iStCtrl = 0x3; // should be 1
#endif
-
- Chip_IOCON_SetPinMuxing(LPC_IOCON, pin_usb_mux, sizeof(pin_usb_mux) / sizeof(PINMUX_GRP_T));
}
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
-#if CFG_TUSB_OS == OPT_OS_NONE
-
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
-uint32_t board_millis(void)
-{
- return system_ticks;
-}
-
-#endif
-
//--------------------------------------------------------------------+
-// LEDS
+// Board porting API
//--------------------------------------------------------------------+
+
void board_led_write(bool state)
{
Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state);
}
-//--------------------------------------------------------------------+
-// BUTTONS
-//--------------------------------------------------------------------+
-#if 0
-static bool button_read(uint8_t id)
-{
-// return !TU_BIT_TEST( GPIO_ReadValue(buttons[id].port), buttons[id].pin ); // button is active low
- return false;
-}
-#endif
-
uint32_t board_button_read(void)
{
- uint32_t result = 0;
-
-// for(uint8_t i=0; i MFlash512
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlash512
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlash512
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlash512
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* DATA section for RamAHB32 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$RamAHB32)
+ *(.data.$RAM2*)
+ *(.data.$RamAHB32*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > RamAHB32 AT>MFlash512
+ /* MAIN DATA SECTION */
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > RamLoc32
+
+ /* Main DATA section (RamLoc32) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > RamLoc32 AT>MFlash512
+
+ /* BSS section for RamAHB32 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$RamAHB32*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > RamAHB32
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > RamLoc32
+
+ /* NOINIT section for RamAHB32 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$RamAHB32*)
+ . = ALIGN(4) ;
+ } > RamAHB32
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > RamLoc32
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (NMI_Handler + 1)
+ + (HardFault_Handler + 1)
+ + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
+ + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
+ + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
+ ) );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+}
\ No newline at end of file
diff --git a/hw/bsp/mcb1800/board.mk b/hw/bsp/mcb1800/board.mk
new file mode 100644
index 00000000..7fdcc077
--- /dev/null
+++ b/hw/bsp/mcb1800/board.mk
@@ -0,0 +1,39 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m3 \
+ -nostdlib \
+ -DCORE_M3 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC18XX \
+ -D__USE_LPCOPEN
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/mcb1800/lpc1857.ld
+
+# TODO remove later
+SRC_C += src/portable/$(VENDOR)/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_18xx/src/chip_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_18xx/src/clock_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_18xx/src/gpio_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_18xx/src/sysinit_18xx_43xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_18xx/src/uart_18xx_43xx.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_18xx/inc \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_18xx/inc/config_18xx
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc18_43
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM3
+
+# For flash-jlink target
+JLINK_DEVICE = LPC1857
+JLINK_IF = swd
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/mcb1800/board_mcb1800.c b/hw/bsp/mcb1800/board_mcb1800.c
index 2b77098f..6f1ef424 100644
--- a/hw/bsp/mcb1800/board_mcb1800.c
+++ b/hw/bsp/mcb1800/board_mcb1800.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,27 +27,36 @@
#include "chip.h"
#include "../board.h"
+// PD_10
#define LED_PORT 6
#define LED_PIN 24
+// P4_0
+#define BUTTON_PORT 2
+#define BUTTON_PIN 0
+
+
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
/* System configuration variables used by chip driver */
-const uint32_t ExtRateIn = 0;
const uint32_t OscRateIn = 12000000;
+const uint32_t ExtRateIn = 0;
static const PINMUX_GRP_T pinmuxing[] =
{
- /* Board LEDs */
+ // LEDs
{0xD, 10, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
- {0xD, 11, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
- {0xD, 12, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
- {0xD, 13, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
- {0xD, 14, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
- {0x9, 0, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0)},
- {0x9, 1, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0)},
- {0x9, 2, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0)},
+ {0xD, 11, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
+ {0xD, 12, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
+ {0xD, 13, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
+ {0xD, 14, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
+ {0x9, 0, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
+ {0x9, 1, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
+ {0x9, 2, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
+
+ // Button
+ {0x4, 0, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLUP)},
/* I2S */
{0x3, 0, (SCU_PINIO_FAST | SCU_MODE_FUNC2)},
@@ -67,10 +76,6 @@ static const PINMUX_GRP_T pinclockmuxing[] =
{0, 3, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0)},
};
-
-/*------------------------------------------------------------------*/
-/* BOARD API
- *------------------------------------------------------------------*/
// Invoked by startup code
void SystemInit(void)
{
@@ -93,29 +98,20 @@ void board_init(void)
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
+ //NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
#endif
Chip_GPIO_Init(LPC_GPIO_PORT);
- //------------- LED -------------//
- /* Port and bit mapping for LEDs on GPIOs */
- const uint8_t ledports[] = {6, 6, 6, 6, 6, 4, 4, 4};
- const uint8_t ledbits[] = {24, 25, 26, 27, 28, 12, 13, 14};
+ // LED
+ Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED_PORT, LED_PIN);
- for (uint32_t i = 0; i < (sizeof(ledports) / sizeof(ledports[0])); i++)
- {
- Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, ledports[i], ledbits[i]);
- Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, false);
- }
+ // Button
+ Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, BUTTON_PORT, BUTTON_PIN);
#if 0
- //------------- BUTTON -------------//
- for(uint8_t i=0; iRESET_CTRL0 @ 0x40053100
+ // LPC_RGU->RESET_CTRL1 @ 0x40053104
+ // Note that we do not use the CMSIS register access mechanism,
+ // as there is no guarantee that the project has been configured
+ // to use CMSIS.
+
+ // Write to LPC_RGU->RESET_CTRL0
+ *(RESET_CONTROL+0) = 0x10DF0000;
+ // GPIO_RST|AES_RST|ETHERNET_RST|SDIO_RST|DMA_RST|
+ // USB1_RST|USB0_RST|LCD_RST
+
+ // Write to LPC_RGU->RESET_CTRL1
+ *(RESET_CONTROL+1) = 0x00DFF7FF;
+ // CAN0_RST|CAN1_RST|I2S_RST|SSP1_RST|SSP0_RST|
+ // I2C1_RST|I2C0_RST|UART3_RST|UART1_RST|UART1_RST|UART0_RST|
+ // DAC_RST|ADC1_RST|ADC0_RST|QEI_RST|MOTOCONPWM_RST|SCT_RST|
+ // RITIMER_RST|TIMER3_RST|TIMER2_RST|TIMER1_RST|TIMER0_RST
+
+ // Clear all pending interrupts in the NVIC
+ volatile unsigned int *NVIC_ICPR = (unsigned int *) 0xE000E280;
+ unsigned int irqpendloop;
+ for (irqpendloop = 0; irqpendloop < 8; irqpendloop++) {
+ *(NVIC_ICPR+irqpendloop)= 0xFFFFFFFF;
+ }
+
+ // Reenable interrupts
+ __asm volatile ("cpsie i");
+ // equivalent to CMSIS '__enable_irq()' function
+
+#endif // ifndef DONT_RESET_ON_RESTART
+// *************************************************************
+
+
+#if defined (__USE_LPCOPEN)
+ SystemInit();
+#endif
+
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+
+ // ******************************
+ // Check to see if we are running the code from a non-zero
+ // address (eg RAM, external flash), in which case we need
+ // to modify the VTOR register to tell the CPU that the
+ // vector table is located at a non-0x0 address.
+
+ // Note that we do not use the CMSIS register access mechanism,
+ // as there is no guarantee that the project has been configured
+ // to use CMSIS.
+ unsigned int * pSCB_VTOR = (unsigned int *) 0xE000ED08;
+ if ((unsigned int *)g_pfnVectors!=(unsigned int *) 0x00000000) {
+ // CMSIS : SCB->VTOR =
+ *pSCB_VTOR = (unsigned int)g_pfnVectors;
+ }
+
+#if defined (__USE_CMSIS)
+ SystemInit();
+#endif
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void MemManage_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void BusFault_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void UsageFault_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void DebugMon_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void) {
+ while (1) {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void) {
+ while (1) {
+ }
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void) {
+ while (1) {
+ }
+}
+
+
+
+
+
+
diff --git a/hw/bsp/mcb1800/lpc1857.ld b/hw/bsp/mcb1800/lpc1857.ld
new file mode 100644
index 00000000..983b41eb
--- /dev/null
+++ b/hw/bsp/mcb1800/lpc1857.ld
@@ -0,0 +1,323 @@
+/*
+ * GENERATED FILE - DO NOT EDIT
+ * (c) Code Red Technologies Ltd, 2008-2013
+ * (c) NXP Semiconductors 2013-2019
+ * Generated linker script file for LPC1857
+ * Created from linkscript.ldt by FMCreateLinkLibraries
+ * Using Freemarker v2.3.23
+ * MCUXpresso IDE v10.2.1 [Build 795] [2018-07-25] on May 15, 2019 1:01:52 PM
+ */
+
+MEMORY
+{
+ /* Define each memory region */
+ MFlashA512 (rx) : ORIGIN = 0x1a000000, LENGTH = 0x80000 /* 512K bytes (alias Flash) */
+ MFlashB512 (rx) : ORIGIN = 0x1b000000, LENGTH = 0x80000 /* 512K bytes (alias Flash2) */
+ RamLoc32 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000 /* 32K bytes (alias RAM) */
+ RamLoc40 (rwx) : ORIGIN = 0x10080000, LENGTH = 0xa000 /* 40K bytes (alias RAM2) */
+ RamAHB32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes (alias RAM3) */
+ RamAHB16 (rwx) : ORIGIN = 0x20008000, LENGTH = 0x4000 /* 16K bytes (alias RAM4) */
+ RamAHB_ETB16 (rwx) : ORIGIN = 0x2000c000, LENGTH = 0x4000 /* 16K bytes (alias RAM5) */
+}
+
+ /* Define a symbol for the top of each memory region */
+ __base_MFlashA512 = 0x1a000000 ; /* MFlashA512 */
+ __base_Flash = 0x1a000000 ; /* Flash */
+ __top_MFlashA512 = 0x1a000000 + 0x80000 ; /* 512K bytes */
+ __top_Flash = 0x1a000000 + 0x80000 ; /* 512K bytes */
+ __base_MFlashB512 = 0x1b000000 ; /* MFlashB512 */
+ __base_Flash2 = 0x1b000000 ; /* Flash2 */
+ __top_MFlashB512 = 0x1b000000 + 0x80000 ; /* 512K bytes */
+ __top_Flash2 = 0x1b000000 + 0x80000 ; /* 512K bytes */
+ __base_RamLoc32 = 0x10000000 ; /* RamLoc32 */
+ __base_RAM = 0x10000000 ; /* RAM */
+ __top_RamLoc32 = 0x10000000 + 0x8000 ; /* 32K bytes */
+ __top_RAM = 0x10000000 + 0x8000 ; /* 32K bytes */
+ __base_RamLoc40 = 0x10080000 ; /* RamLoc40 */
+ __base_RAM2 = 0x10080000 ; /* RAM2 */
+ __top_RamLoc40 = 0x10080000 + 0xa000 ; /* 40K bytes */
+ __top_RAM2 = 0x10080000 + 0xa000 ; /* 40K bytes */
+ __base_RamAHB32 = 0x20000000 ; /* RamAHB32 */
+ __base_RAM3 = 0x20000000 ; /* RAM3 */
+ __top_RamAHB32 = 0x20000000 + 0x8000 ; /* 32K bytes */
+ __top_RAM3 = 0x20000000 + 0x8000 ; /* 32K bytes */
+ __base_RamAHB16 = 0x20008000 ; /* RamAHB16 */
+ __base_RAM4 = 0x20008000 ; /* RAM4 */
+ __top_RamAHB16 = 0x20008000 + 0x4000 ; /* 16K bytes */
+ __top_RAM4 = 0x20008000 + 0x4000 ; /* 16K bytes */
+ __base_RamAHB_ETB16 = 0x2000c000 ; /* RamAHB_ETB16 */
+ __base_RAM5 = 0x2000c000 ; /* RAM5 */
+ __top_RamAHB_ETB16 = 0x2000c000 + 0x4000 ; /* 16K bytes */
+ __top_RAM5 = 0x2000c000 + 0x4000 ; /* 16K bytes */
+
+ENTRY(ResetISR)
+
+SECTIONS
+{
+ .text_Flash2 : ALIGN(4)
+ {
+ FILL(0xff)
+ *(.text_Flash2*) /* for compatibility with previous releases */
+ *(.text_MFlashB512*) /* for compatibility with previous releases */
+ *(.text.$Flash2*)
+ *(.text.$MFlashB512*)
+ *(.rodata.$Flash2*)
+ *(.rodata.$MFlashB512*)
+ } > MFlashB512
+
+ /* MAIN TEXT SECTION */
+ .text : ALIGN(4)
+ {
+ FILL(0xff)
+ __vectors_start__ = ABSOLUTE(.) ;
+ KEEP(*(.isr_vector))
+ /* Global Section Table */
+ . = ALIGN(4) ;
+ __section_table_start = .;
+ __data_section_table = .;
+ LONG(LOADADDR(.data));
+ LONG( ADDR(.data));
+ LONG( SIZEOF(.data));
+ LONG(LOADADDR(.data_RAM2));
+ LONG( ADDR(.data_RAM2));
+ LONG( SIZEOF(.data_RAM2));
+ LONG(LOADADDR(.data_RAM3));
+ LONG( ADDR(.data_RAM3));
+ LONG( SIZEOF(.data_RAM3));
+ LONG(LOADADDR(.data_RAM4));
+ LONG( ADDR(.data_RAM4));
+ LONG( SIZEOF(.data_RAM4));
+ LONG(LOADADDR(.data_RAM5));
+ LONG( ADDR(.data_RAM5));
+ LONG( SIZEOF(.data_RAM5));
+ __data_section_table_end = .;
+ __bss_section_table = .;
+ LONG( ADDR(.bss));
+ LONG( SIZEOF(.bss));
+ LONG( ADDR(.bss_RAM2));
+ LONG( SIZEOF(.bss_RAM2));
+ LONG( ADDR(.bss_RAM3));
+ LONG( SIZEOF(.bss_RAM3));
+ LONG( ADDR(.bss_RAM4));
+ LONG( SIZEOF(.bss_RAM4));
+ LONG( ADDR(.bss_RAM5));
+ LONG( SIZEOF(.bss_RAM5));
+ __bss_section_table_end = .;
+ __section_table_end = . ;
+ /* End of Global Section Table */
+
+ *(.after_vectors*)
+
+ } > MFlashA512
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlashA512
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlashA512
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlashA512
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* DATA section for RamLoc40 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$RamLoc40)
+ *(.data.$RAM2*)
+ *(.data.$RamLoc40*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > RamLoc40 AT>MFlashA512
+ /* DATA section for RamAHB32 */
+
+ .data_RAM3 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM3 = .) ;
+ *(.ramfunc.$RAM3)
+ *(.ramfunc.$RamAHB32)
+ *(.data.$RAM3*)
+ *(.data.$RamAHB32*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM3 = .) ;
+ } > RamAHB32 AT>MFlashA512
+ /* DATA section for RamAHB16 */
+
+ .data_RAM4 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM4 = .) ;
+ *(.ramfunc.$RAM4)
+ *(.ramfunc.$RamAHB16)
+ *(.data.$RAM4*)
+ *(.data.$RamAHB16*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM4 = .) ;
+ } > RamAHB16 AT>MFlashA512
+ /* DATA section for RamAHB_ETB16 */
+
+ .data_RAM5 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM5 = .) ;
+ *(.ramfunc.$RAM5)
+ *(.ramfunc.$RamAHB_ETB16)
+ *(.data.$RAM5*)
+ *(.data.$RamAHB_ETB16*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM5 = .) ;
+ } > RamAHB_ETB16 AT>MFlashA512
+ /* MAIN DATA SECTION */
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > RamLoc32
+
+ /* Main DATA section (RamLoc32) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > RamLoc32 AT>MFlashA512
+
+ /* BSS section for RamLoc40 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$RamLoc40*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > RamLoc40
+
+ /* BSS section for RamAHB32 */
+ .bss_RAM3 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM3 = .) ;
+ *(.bss.$RAM3*)
+ *(.bss.$RamAHB32*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM3 = .) ;
+ } > RamAHB32
+
+ /* BSS section for RamAHB16 */
+ .bss_RAM4 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM4 = .) ;
+ *(.bss.$RAM4*)
+ *(.bss.$RamAHB16*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM4 = .) ;
+ } > RamAHB16
+
+ /* BSS section for RamAHB_ETB16 */
+ .bss_RAM5 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM5 = .) ;
+ *(.bss.$RAM5*)
+ *(.bss.$RamAHB_ETB16*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM5 = .) ;
+ } > RamAHB_ETB16
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > RamLoc32
+
+ /* NOINIT section for RamLoc40 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$RamLoc40*)
+ . = ALIGN(4) ;
+ } > RamLoc40
+
+ /* NOINIT section for RamAHB32 */
+ .noinit_RAM3 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM3*)
+ *(.noinit.$RamAHB32*)
+ . = ALIGN(4) ;
+ } > RamAHB32
+
+ /* NOINIT section for RamAHB16 */
+ .noinit_RAM4 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM4*)
+ *(.noinit.$RamAHB16*)
+ . = ALIGN(4) ;
+ } > RamAHB16
+
+ /* NOINIT section for RamAHB_ETB16 */
+ .noinit_RAM5 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM5*)
+ *(.noinit.$RamAHB_ETB16*)
+ . = ALIGN(4) ;
+ } > RamAHB_ETB16
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > RamLoc32
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (NMI_Handler + 1)
+ + (HardFault_Handler + 1)
+ + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
+ + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
+ + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
+ ) );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+}
\ No newline at end of file
diff --git a/hw/bsp/metro_m0_express/board.mk b/hw/bsp/metro_m0_express/board.mk
index 76614d2a..3ea67280 100644
--- a/hw/bsp/metro_m0_express/board.mk
+++ b/hw/bsp/metro_m0_express/board.mk
@@ -1,19 +1,15 @@
CFLAGS += \
- -DCFG_TUSB_MCU=OPT_MCU_SAMD21 \
- -DCONF_DFLL_OVERWRITE_CALIBRATION=0 \
- -D__SAMD21G18A__ \
- -mthumb \
- -mabi=aapcs-linux \
- -mcpu=cortex-m0plus \
- -msoft-float \
- -mfloat-abi=soft \
- -nostdlib -nostartfiles
+ -DCONF_DFLL_OVERWRITE_CALIBRATION=0 \
+ -D__SAMD21G18A__ \
+ -mthumb \
+ -mabi=aapcs-linux \
+ -mcpu=cortex-m0plus \
+ -nostdlib -nostartfiles \
+ -DCFG_TUSB_MCU=OPT_MCU_SAMD21
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/metro_m0_express/samd21g18a_flash.ld
-LD_FLAGS += -mthumb -mcpu=cortex-m0plus
-
SRC_C += \
hw/mcu/microchip/samd/asf4/samd21/gcc/gcc/startup_samd21.c \
hw/mcu/microchip/samd/asf4/samd21/gcc/system_samd21.c \
diff --git a/hw/bsp/metro_m0_express/board_metro_m0_express.c b/hw/bsp/metro_m0_express/board_metro_m0_express.c
index 792ce138..8c7bd443 100644
--- a/hw/bsp/metro_m0_express/board_metro_m0_express.c
+++ b/hw/bsp/metro_m0_express/board_metro_m0_express.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -101,6 +101,10 @@ void board_init(void)
_gclk_enable_channel(TCC0_GCLK_ID, GCLK_CLKCTRL_GEN_GCLK0_Val);
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
+
void board_led_write(bool state)
{
gpio_set_pin_level(LED_PIN, state);
@@ -114,7 +118,6 @@ uint32_t board_button_read(void)
#if CFG_TUSB_OS == OPT_OS_NONE
volatile uint32_t system_ticks = 0;
-
void SysTick_Handler (void)
{
system_ticks++;
@@ -124,5 +127,4 @@ uint32_t board_millis(void)
{
return system_ticks;
}
-
#endif
diff --git a/hw/bsp/metro_m4_express/board.mk b/hw/bsp/metro_m4_express/board.mk
index 2063d9ea..c62d9bc3 100644
--- a/hw/bsp/metro_m4_express/board.mk
+++ b/hw/bsp/metro_m4_express/board.mk
@@ -1,20 +1,18 @@
CFLAGS += \
- -DCFG_TUSB_MCU=OPT_MCU_SAMD51 \
- -D__SAMD51J19A__ \
- -mthumb \
- -mabi=aapcs-linux \
- -mcpu=cortex-m4 \
- -mfloat-abi=hard \
- -mfpu=fpv4-sp-d16 \
- -nostdlib -nostartfiles
+ -D__SAMD51J19A__ \
+ -mthumb \
+ -mabi=aapcs-linux \
+ -mcpu=cortex-m4 \
+ -mfloat-abi=hard \
+ -mfpu=fpv4-sp-d16 \
+ -nostdlib -nostartfiles \
+ -DCFG_TUSB_MCU=OPT_MCU_SAMD51
CFLAGS += -Wno-error=undef
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/metro_m4_express/samd51g19a_flash.ld
-LDFLAGS += -mthumb -mcpu=cortex-m4
-
SRC_C += \
hw/mcu/microchip/samd/asf4/samd51/gcc/gcc/startup_samd51.c \
hw/mcu/microchip/samd/asf4/samd51/gcc/system_samd51.c \
diff --git a/hw/bsp/metro_m4_express/board_metro_m4_express.c b/hw/bsp/metro_m4_express/board_metro_m4_express.c
index c50b5c17..7c1b9ace 100644
--- a/hw/bsp/metro_m4_express/board_metro_m4_express.c
+++ b/hw/bsp/metro_m4_express/board_metro_m4_express.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -90,6 +90,10 @@ void board_init(void)
gpio_set_pin_function(PIN_PA25, PINMUX_PA25H_USB_DP);
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
+
void board_led_write(bool state)
{
gpio_set_pin_level(LED_PIN, state);
@@ -101,9 +105,6 @@ uint32_t board_button_read(void)
return gpio_get_pin_level(BUTTON_PIN) ? 0 : 1;
}
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
#if CFG_TUSB_OS == OPT_OS_NONE
volatile uint32_t system_ticks = 0;
diff --git a/hw/bsp/pca10056/board.mk b/hw/bsp/pca10056/board.mk
index 317a4969..baea5fdc 100644
--- a/hw/bsp/pca10056/board.mk
+++ b/hw/bsp/pca10056/board.mk
@@ -1,12 +1,12 @@
CFLAGS += \
- -mthumb \
- -mabi=aapcs \
- -mcpu=cortex-m4 \
- -mfloat-abi=hard \
- -mfpu=fpv4-sp-d16 \
- -DCFG_TUSB_MCU=OPT_MCU_NRF5X \
- -DNRF52840_XXAA \
- -DCONFIG_GPIO_AS_PINRESET
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m4 \
+ -mfloat-abi=hard \
+ -mfpu=fpv4-sp-d16 \
+ -DNRF52840_XXAA \
+ -DCONFIG_GPIO_AS_PINRESET \
+ -DCFG_TUSB_MCU=OPT_MCU_NRF5X
# nrfx issue undef _ARMCC_VERSION usage https://github.com/NordicSemiconductor/nrfx/issues/49
CFLAGS += -Wno-error=undef
@@ -35,9 +35,6 @@ INC += \
SRC_S += hw/mcu/nordic/nrfx/mdk/gcc_startup_nrf52840.S
ASFLAGS += -D__HEAP_SIZE=0
-ASFLAGS += -DSWI_DISABLE0
-ASFLAGS += -DFLOAT_ABI_HARD
-ASFLAGS += -DNRF52840_XXAA
# For TinyUSB port source
VENDOR = nordic
diff --git a/hw/bsp/pca10056/board_pca10056.c b/hw/bsp/pca10056/board_pca10056.c
index bc054406..5ee6383f 100644
--- a/hw/bsp/pca10056/board_pca10056.c
+++ b/hw/bsp/pca10056/board_pca10056.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -44,28 +44,6 @@
#define BUTTON_PIN 11
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
-#if CFG_TUSB_OS == OPT_OS_NONE
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
-uint32_t board_millis(void)
-{
- return system_ticks;
-}
-
-#endif
-
-/*------------------------------------------------------------------*/
-/* BOARD API
- *------------------------------------------------------------------*/
-
// tinyusb function that handles power event (detected, ready, removed)
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
extern void tusb_hal_nrf_power_event(uint32_t event);
@@ -126,6 +104,10 @@ void board_init(void)
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
+
void board_led_write(bool state)
{
nrf_gpio_pin_write(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
@@ -151,6 +133,19 @@ int board_uart_write(void const * buf, int len)
return 0;
}
+#if CFG_TUSB_OS == OPT_OS_NONE
+volatile uint32_t system_ticks = 0;
+void SysTick_Handler (void)
+{
+ system_ticks++;
+}
+
+uint32_t board_millis(void)
+{
+ return system_ticks;
+}
+#endif
+
#ifdef SOFTDEVICE_PRESENT
// process SOC event from SD
uint32_t proc_soc(void)
diff --git a/hw/bsp/printf_retarget.c b/hw/bsp/printf_retarget.c
index 0c1d80d1..707a1e09 100644
--- a/hw/bsp/printf_retarget.c
+++ b/hw/bsp/printf_retarget.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/hw/bsp/stm32f303disc/board.mk b/hw/bsp/stm32f303disc/board.mk
index 8efa5e6a..76922a46 100644
--- a/hw/bsp/stm32f303disc/board.mk
+++ b/hw/bsp/stm32f303disc/board.mk
@@ -12,8 +12,6 @@ CFLAGS += \
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/stm32f303disc/STM32F303VCTx_FLASH.ld
-LDFLAGS += -mthumb -mcpu=cortex-m4
-
SRC_C += \
hw/mcu/st/system-init/system_stm32f3xx.c \
hw/mcu/st/stm32lib/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c \
diff --git a/hw/bsp/stm32f303disc/board_stm32f303disc.c b/hw/bsp/stm32f303disc/board_stm32f303disc.c
index b29a0fcc..9a103ac6 100644
--- a/hw/bsp/stm32f303disc/board_stm32f303disc.c
+++ b/hw/bsp/stm32f303disc/board_stm32f303disc.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -91,6 +91,9 @@ void board_init(void)
#endif
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
void board_led_write(bool state)
{
@@ -103,9 +106,6 @@ uint32_t board_button_read(void)
return 0;
}
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
#if CFG_TUSB_OS == OPT_OS_NONE
volatile uint32_t system_ticks = 0;
diff --git a/hw/bsp/stm32f407g_disc1/board.mk b/hw/bsp/stm32f407g_disc1/board.mk
index ad13c104..ab3043a4 100644
--- a/hw/bsp/stm32f407g_disc1/board.mk
+++ b/hw/bsp/stm32f407g_disc1/board.mk
@@ -1,19 +1,17 @@
CFLAGS += \
- -DHSE_VALUE=8000000 \
- -DCFG_TUSB_MCU=OPT_MCU_STM32F4 \
- -DSTM32F407xx \
- -mthumb \
- -mabi=aapcs-linux \
- -mcpu=cortex-m4 \
- -mfloat-abi=hard \
- -mfpu=fpv4-sp-d16 \
- -nostdlib -nostartfiles
+ -DHSE_VALUE=8000000 \
+ -DSTM32F407xx \
+ -mthumb \
+ -mabi=aapcs-linux \
+ -mcpu=cortex-m4 \
+ -mfloat-abi=hard \
+ -mfpu=fpv4-sp-d16 \
+ -nostdlib -nostartfiles \
+ -DCFG_TUSB_MCU=OPT_MCU_STM32F4
# All source paths should be relative to the top level.
LD_FILE = hw/bsp/stm32f407g_disc1/STM32F407VGTx_FLASH.ld
-LDFLAGS += -mthumb -mcpu=cortex-m4
-
SRC_C += \
hw/mcu/st/system-init/system_stm32f4xx.c
diff --git a/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c b/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c
index 824a8da4..c5695733 100644
--- a/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c
+++ b/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -34,6 +34,8 @@ void board_init(void)
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
GPIOD->MODER |= GPIO_MODER_MODE14_0;
+ // TODO Button
+
// USB Clock init
// PLL input- 8 MHz (External oscillator clock; HSI clock tolerance isn't
// tight enough- 1%, need 0.25%)
@@ -59,10 +61,13 @@ void board_init(void)
// Notify runtime of frequency change.
SystemCoreClockUpdate();
- #if CFG_TUSB_OS == OPT_OS_NONE
+#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
- #endif
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
+ //NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
+#endif
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
@@ -81,6 +86,9 @@ void board_init(void)
GPIOA->PUPDR |= GPIO_PUPDR_PUPD10_0;
}
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
void board_led_write(bool state)
{
@@ -98,12 +106,8 @@ uint32_t board_button_read(void)
}
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
#if CFG_TUSB_OS == OPT_OS_NONE
volatile uint32_t system_ticks = 0;
-
void SysTick_Handler (void)
{
system_ticks++;
diff --git a/hw/mcu/st/stm32lib b/hw/mcu/st/stm32lib
index 166a236c..1dabc2df 160000
--- a/hw/mcu/st/stm32lib
+++ b/hw/mcu/st/stm32lib
@@ -1 +1 @@
-Subproject commit 166a236ca1fc35943cb0c747e2db7deffd5558c3
+Subproject commit 1dabc2df8ed1acaf0c483b58d757ba72e8b42090
diff --git a/lib/fatfs/diskio.c b/lib/fatfs/diskio.c
index b7650131..38503148 100644
--- a/lib/fatfs/diskio.c
+++ b/lib/fatfs/diskio.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/audio/audio.h b/src/class/audio/audio.h
index 8ef9389a..c655e79e 100644
--- a/src/class/audio/audio.h
+++ b/src/class/audio/audio.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc.h b/src/class/cdc/cdc.h
index a764f15d..200f6eaa 100644
--- a/src/class/cdc/cdc.h
+++ b/src/class/cdc/cdc.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index 7a0380e6..81ce2e43 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -99,7 +99,7 @@ static void _prep_out_transaction (uint8_t itf)
bool tud_cdc_n_connected(uint8_t itf)
{
// DTR (bit 0) active is considered as connected
- return tud_ready() && TU_BIT_TEST(_cdcd_itf[itf].line_state, 0);
+ return tud_ready() && tu_bit_test(_cdcd_itf[itf].line_state, 0);
}
uint8_t tud_cdc_n_get_line_state (uint8_t itf)
@@ -358,7 +358,7 @@ bool cdcd_control_request(uint8_t rhport, tusb_control_request_t const * request
usbd_control_status(rhport, request);
// Invoke callback
- if ( tud_cdc_line_state_cb) tud_cdc_line_state_cb(itf, TU_BIT_TEST(request->wValue, 0), TU_BIT_TEST(request->wValue, 1));
+ if ( tud_cdc_line_state_cb) tud_cdc_line_state_cb(itf, tu_bit_test(request->wValue, 0), tu_bit_test(request->wValue, 1));
break;
default: return false; // stall unsupported request
diff --git a/src/class/cdc/cdc_device.h b/src/class/cdc/cdc_device.h
index 18d6f842..44fd9215 100644
--- a/src/class/cdc/cdc_device.h
+++ b/src/class/cdc/cdc_device.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c
index 75c80515..b64d4a1f 100644
--- a/src/class/cdc/cdc_host.c
+++ b/src/class/cdc/cdc_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_host.h b/src/class/cdc/cdc_host.h
index 7a302eb0..59ad2bfa 100644
--- a/src/class/cdc/cdc_host.h
+++ b/src/class/cdc/cdc_host.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_rndis.h b/src/class/cdc/cdc_rndis.h
index 70f76604..e0f129fe 100644
--- a/src/class/cdc/cdc_rndis.h
+++ b/src/class/cdc/cdc_rndis.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/cdc/cdc_rndis_host.c b/src/class/cdc/cdc_rndis_host.c
index 587e9ddc..c604aef4 100644
--- a/src/class/cdc/cdc_rndis_host.c
+++ b/src/class/cdc/cdc_rndis_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -43,7 +43,7 @@
CFG_TUSB_MEM_SECTION static uint8_t msg_notification[CFG_TUSB_HOST_DEVICE_MAX][8];
CFG_TUSB_MEM_SECTION ATTR_ALIGNED(4) static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX];
-STATIC_VAR rndish_data_t rndish_data[CFG_TUSB_HOST_DEVICE_MAX];
+static rndish_data_t rndish_data[CFG_TUSB_HOST_DEVICE_MAX];
// TODO Microsoft requires message length for any get command must be at least 4096 bytes
diff --git a/src/class/cdc/cdc_rndis_host.h b/src/class/cdc/cdc_rndis_host.h
index 24becee0..170cb3b0 100644
--- a/src/class/cdc/cdc_rndis_host.h
+++ b/src/class/cdc/cdc_rndis_host.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/custom/custom_device.c b/src/class/custom/custom_device.c
index 04921259..18aea94c 100644
--- a/src/class/custom/custom_device.c
+++ b/src/class/custom/custom_device.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/custom/custom_device.h b/src/class/custom/custom_device.h
index 704ecb23..02cdba7e 100644
--- a/src/class/custom/custom_device.h
+++ b/src/class/custom/custom_device.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/custom/custom_host.c b/src/class/custom/custom_host.c
index 488e26b2..a4f04af3 100644
--- a/src/class/custom/custom_host.c
+++ b/src/class/custom/custom_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/custom/custom_host.h b/src/class/custom/custom_host.h
index cf612a40..2ca16222 100644
--- a/src/class/custom/custom_host.h
+++ b/src/class/custom/custom_host.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid.h b/src/class/hid/hid.h
index 7c702f4d..902c01ef 100644
--- a/src/class/hid/hid.h
+++ b/src/class/hid/hid.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c
index 1c971a60..9089ac6b 100644
--- a/src/class/hid/hid_device.c
+++ b/src/class/hid/hid_device.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h
index f838e6fa..be799977 100644
--- a/src/class/hid/hid_device.h
+++ b/src/class/hid/hid_device.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index 5aabbc01..91a441af 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -111,7 +111,7 @@ bool tuh_hid_keyboard_is_busy(uint8_t dev_addr)
//--------------------------------------------------------------------+
#if CFG_TUH_HID_MOUSE
-STATIC_VAR hidh_interface_info_t mouseh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
+static hidh_interface_info_t mouseh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1
//------------- Public API -------------//
bool tuh_hid_mouse_is_mounted(uint8_t dev_addr)
diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h
index 8fa974c9..50eabba3 100644
--- a/src/class/hid/hid_host.h
+++ b/src/class/hid/hid_host.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/midi/midi.h b/src/class/midi/midi.h
index 0c26c188..ee318f78 100644
--- a/src/class/midi/midi.h
+++ b/src/class/midi/midi.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c
index 5ba111a2..e834e063 100644
--- a/src/class/midi/midi_device.c
+++ b/src/class/midi/midi_device.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/midi/midi_device.h b/src/class/midi/midi_device.h
index a4351404..84f4c57b 100644
--- a/src/class/midi/midi_device.h
+++ b/src/class/midi/midi_device.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/msc/msc.h b/src/class/msc/msc.h
index bdf906b4..95fac659 100644
--- a/src/class/msc/msc.h
+++ b/src/class/msc/msc.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c
index c486d5e0..2fd3d44a 100644
--- a/src/class/msc/msc_device.c
+++ b/src/class/msc/msc_device.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -80,7 +80,8 @@ static inline uint32_t rdwr10_get_lba(uint8_t const command[])
uint32_t lba;
memcpy(&lba, &p_rdwr10->lba, 4);
- return __be2n(lba);
+ // lba is in Big Endian format
+ return tu_ntohl(lba);
}
static inline uint16_t rdwr10_get_blockcount(uint8_t const command[])
@@ -92,7 +93,7 @@ static inline uint16_t rdwr10_get_blockcount(uint8_t const command[])
uint16_t block_count;
memcpy(&block_count, &p_rdwr10->block_count, 2);
- return __be2n_16(block_count);
+ return tu_ntohs(block_count);
}
//--------------------------------------------------------------------+
@@ -238,8 +239,8 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff
{
scsi_read_capacity10_resp_t read_capa10;
- read_capa10.last_lba = ENDIAN_BE(block_count-1);
- read_capa10.block_size = ENDIAN_BE(block_size);
+ read_capa10.last_lba = tu_htonl(block_count-1);
+ read_capa10.block_size = tu_htonl(block_size);
resplen = sizeof(read_capa10);
memcpy(buffer, &read_capa10, resplen);
@@ -272,8 +273,8 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff
if ( _mscd_itf.sense_key == 0 ) tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x04, 0x00);
}else
{
- read_fmt_capa.block_num = ENDIAN_BE(block_count);
- read_fmt_capa.block_size_u16 = ENDIAN_BE16(block_size);
+ read_fmt_capa.block_num = tu_htonl(block_count);
+ read_fmt_capa.block_size_u16 = tu_htons(block_size);
resplen = sizeof(read_fmt_capa);
memcpy(buffer, &read_fmt_capa, resplen);
@@ -390,7 +391,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t
// For other SCSI commands
// 1. OUT : queue transfer (invoke app callback after done)
// 2. IN & Zero: Process if is built-in, else Invoke app callback. Skip DATA if zero length
- if ( (p_cbw->total_bytes > 0 ) && !TU_BIT_TEST(p_cbw->dir, 7) )
+ if ( (p_cbw->total_bytes > 0 ) && !tu_bit_test(p_cbw->dir, 7) )
{
// queue transfer
TU_ASSERT( dcd_edpt_xfer(rhport, p_msc->ep_out, _mscd_buf, p_msc->total_len) );
@@ -439,7 +440,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t
case MSC_STAGE_DATA:
// OUT transfer, invoke callback if needed
- if ( !TU_BIT_TEST(p_cbw->dir, 7) )
+ if ( !tu_bit_test(p_cbw->dir, 7) )
{
if ( SCSI_CMD_WRITE_10 != p_cbw->command[0] )
{
diff --git a/src/class/msc/msc_device.h b/src/class/msc/msc_device.h
index 1baf2d19..cf228dad 100644
--- a/src/class/msc/msc_device.h
+++ b/src/class/msc/msc_device.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c
index bb12c52d..d2a1a00f 100644
--- a/src/class/msc/msc_host.c
+++ b/src/class/msc/msc_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -232,8 +232,8 @@ tusb_error_t tuh_msc_read10(uint8_t dev_addr, uint8_t lun, void * p_buffer, uin
scsi_read10_t cmd_read10 =
{
.cmd_code = SCSI_CMD_READ_10,
- .lba = __n2be(lba),
- .block_count = tu_u16_le2be(block_count)
+ .lba = tu_htonl(lba),
+ .block_count = tu_htons(block_count)
};
memcpy(p_msch->cbw.command, &cmd_read10, p_msch->cbw.cmd_len);
@@ -258,8 +258,8 @@ tusb_error_t tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * p_buffe
scsi_write10_t cmd_write10 =
{
.cmd_code = SCSI_CMD_WRITE_10,
- .lba = __n2be(lba),
- .block_count = tu_u16_le2be(block_count)
+ .lba = tu_htonl(lba),
+ .block_count = tu_htons(block_count)
};
memcpy(p_msch->cbw.command, &cmd_write10, p_msch->cbw.cmd_len);
@@ -372,8 +372,8 @@ bool msch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
TU_ASSERT(osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT));
}
- p_msc->last_lba = __be2n( ((scsi_read_capacity10_resp_t*)msch_buffer)->last_lba );
- p_msc->block_size = (uint16_t) __be2n( ((scsi_read_capacity10_resp_t*)msch_buffer)->block_size );
+ p_msc->last_lba = tu_ntohl( ((scsi_read_capacity10_resp_t*)msch_buffer)->last_lba );
+ p_msc->block_size = (uint16_t) tu_ntohl( ((scsi_read_capacity10_resp_t*)msch_buffer)->block_size );
p_msc->is_initialized = true;
diff --git a/src/class/msc/msc_host.h b/src/class/msc/msc_host.h
index 1edce82c..da817fbe 100644
--- a/src/class/msc/msc_host.h
+++ b/src/class/msc/msc_host.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/common/compiler/tusb_compiler_gcc.h b/src/common/compiler/tusb_compiler_gcc.h
deleted file mode 100644
index bb2d0b56..00000000
--- a/src/common/compiler/tusb_compiler_gcc.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2018, hathach (tinyusb.org)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * This file is part of the TinyUSB stack.
- */
-
-/** \ingroup Group_Compiler
- * \defgroup Group_GCC GNU GCC
- * @{ */
-
-#ifndef _TUSB_COMPILER_GCC_H_
-#define _TUSB_COMPILER_GCC_H_
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-#define ALIGN_OF(x) __alignof__(x)
-
-// Specifies a minimum alignment for the variable or structure field, measured in bytes
-#define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
-
-// Place variable in a specific section
-#define ATTR_SECTION(sec_name) __attribute__ (( section(#sec_name) ))
-
-// Packed struct/variable into smallest possible size
-#define ATTR_PACKED __attribute__ ((packed))
-#define ATTR_PREPACKED
-
-// The deprecated attribute results in a warning if the function is used.
-#define ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess)))
-
-// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global.
-#define ATTR_WEAK __attribute__ ((weak))
-
-// Function/Variable is meant to be possibly unused (thus no warning)
-#define ATTR_UNUSED __attribute__ ((unused))
-
-// TODO mcu specific
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-#define __n2be(x) __builtin_bswap32(x) ///< built-in function to convert 32-bit from native to Big Endian
-#define __be2n(x) __n2be(x) ///< built-in function to convert 32-bit from Big Endian to native
-
-#define __n2be_16(u16) __builtin_bswap16(u16)
-#define __be2n_16(u16) __n2be_16(u16)
-#endif
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _TUSB_COMPILER_GCC_H_ */
-
-/// @}
diff --git a/src/common/compiler/tusb_compiler_iar.h b/src/common/compiler/tusb_compiler_iar.h
deleted file mode 100644
index 326a4003..00000000
--- a/src/common/compiler/tusb_compiler_iar.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2018, hathach (tinyusb.org)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * This file is part of the TinyUSB stack.
- */
-
-#ifndef _TUSB_COMPILER_IAR_H_
-#define _TUSB_COMPILER_IAR_H_
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-#define ALIGN_OF(x) __ALIGNOF__(x)
-#define ATTR_ALIGNED(bytes) _Pragma(XSTRING_(data_alignment=##bytes))
-//#define ATTR_SECTION(section) _Pragma((#section))
-#define ATTR_PREPACKED __packed
-#define ATTR_PACKED
-#define ATTR_DEPRECATED(mess)
-#define ATTR_WEAK __weak
-#define ATTR_UNUSED
-
-// built-in function to convert 32-bit Big-Endian to Little-Endian
-//#if __LITTLE_ENDIAN__
-#define __be2n __REV
-#define __n2be __be2n
-
-#define __n2be_16(u16) ((uint16_t) __REV16(u16))
-#define __be2n_16(u16) __n2be_16(u16)
-
-#error "IAR won't work due to '__packed' placement before struct"
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _TUSB_COMPILER_IAR_H_ */
-
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h
index e687b898..4b74bcfc 100644
--- a/src/common/tusb_common.h
+++ b/src/common/tusb_common.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -38,65 +38,27 @@
//--------------------------------------------------------------------+
// Macros Helper
//--------------------------------------------------------------------+
-#define TU_ARRAY_SZIE(_arr) ( sizeof(_arr) / sizeof(_arr[0]) )
-#define TU_MIN(_x, _y) ( (_x) < (_y) ) ? (_x) : (_y) )
-#define TU_MAX(_x, _y) ( (_x) > (_y) ) ? (_x) : (_y) )
+#define TU_ARRAY_SZIE(_arr) ( sizeof(_arr) / sizeof(_arr[0]) )
+#define TU_MIN(_x, _y) ( (_x) < (_y) ) ? (_x) : (_y) )
+#define TU_MAX(_x, _y) ( (_x) > (_y) ) ? (_x) : (_y) )
-#define U16_HIGH_U8(u16) ((uint8_t) (((u16) >> 8) & 0x00ff))
-#define U16_LOW_U8(u16) ((uint8_t) ((u16) & 0x00ff))
-#define U16_TO_U8S_BE(u16) U16_HIGH_U8(u16), U16_LOW_U8(u16)
-#define U16_TO_U8S_LE(u16) U16_LOW_U8(u16), U16_HIGH_U8(u16)
+#define TU_U16_HIGH(u16) ((uint8_t) (((u16) >> 8) & 0x00ff))
+#define TU_U16_LOW(u16) ((uint8_t) ((u16) & 0x00ff))
+#define U16_TO_U8S_BE(u16) TU_U16_HIGH(u16), TU_U16_LOW(u16)
+#define U16_TO_U8S_LE(u16) TU_U16_LOW(u16), TU_U16_HIGH(u16)
-#define U32_B1_U8(u32) ((uint8_t) (((u32) >> 24) & 0x000000ff)) // MSB
-#define U32_B2_U8(u32) ((uint8_t) (((u32) >> 16) & 0x000000ff))
-#define U32_B3_U8(u32) ((uint8_t) (((u32) >> 8) & 0x000000ff))
-#define U32_B4_U8(u32) ((uint8_t) ((u32) & 0x000000ff)) // LSB
+#define U32_B1_U8(u32) ((uint8_t) (((u32) >> 24) & 0x000000ff)) // MSB
+#define U32_B2_U8(u32) ((uint8_t) (((u32) >> 16) & 0x000000ff))
+#define U32_B3_U8(u32) ((uint8_t) (((u32) >> 8) & 0x000000ff))
+#define U32_B4_U8(u32) ((uint8_t) ((u32) & 0x000000ff)) // LSB
-#define U32_TO_U8S_BE(u32) U32_B1_U8(u32), U32_B2_U8(u32), U32_B3_U8(u32), U32_B4_U8(u32)
-#define U32_TO_U8S_LE(u32) U32_B4_U8(u32), U32_B3_U8(u32), U32_B2_U8(u32), U32_B1_U8(u32)
+#define U32_TO_U8S_BE(u32) U32_B1_U8(u32), U32_B2_U8(u32), U32_B3_U8(u32), U32_B4_U8(u32)
+#define U32_TO_U8S_LE(u32) U32_B4_U8(u32), U32_B3_U8(u32), U32_B2_U8(u32), U32_B1_U8(u32)
-//------------- Bit -------------//
-#define TU_BIT(n) (1U << (n)) ///< n-th Bit
-#define TU_BIT_SET(x, n) ( (x) | TU_BIT(n) ) ///< set n-th bit of x to 1
-#define TU_BIT_CLEAR(x, n) ( (x) & (~TU_BIT(n)) ) ///< clear n-th bit of x
-#define TU_BIT_TEST(x, n) ( ((x) & TU_BIT(n)) ? true : false ) ///< check if n-th bit of x is 1
-
-//------------- Endian Conversion -------------//
-#define ENDIAN_BE(u32) \
- (uint32_t) ( (((u32) & 0xFF) << 24) | (((u32) & 0xFF00) << 8) | (((u32) >> 8) & 0xFF00) | (((u32) >> 24) & 0xFF) )
-
-#define ENDIAN_BE16(le16) ((uint16_t) ((U16_LOW_U8(le16) << 8) | U16_HIGH_U8(le16)) )
-
-//------------- Binary constant -------------//
-#if defined(__GNUC__) && !defined(__CC_ARM)
-
-#define TU_BIN8(x) ((uint8_t) (0b##x))
-#define TU_BIN16(b1, b2) ((uint16_t) (0b##b1##b2))
-#define TU_BIN32(b1, b2, b3, b4) ((uint32_t) (0b##b1##b2##b3##b4))
-
-#else
-
-// internal macro of B8, B16, B32
-#define _B8__(x) (((x&0x0000000FUL)?1:0) \
- +((x&0x000000F0UL)?2:0) \
- +((x&0x00000F00UL)?4:0) \
- +((x&0x0000F000UL)?8:0) \
- +((x&0x000F0000UL)?16:0) \
- +((x&0x00F00000UL)?32:0) \
- +((x&0x0F000000UL)?64:0) \
- +((x&0xF0000000UL)?128:0))
-
-#define TU_BIN8(d) ((uint8_t) _B8__(0x##d##UL))
-#define TU_BIN16(dmsb,dlsb) (((uint16_t)TU_BIN8(dmsb)<<8) + TU_BIN8(dlsb))
-#define TU_BIN32(dmsb,db2,db3,dlsb) \
- (((uint32_t)TU_BIN8(dmsb)<<24) \
- + ((uint32_t)TU_BIN8(db2)<<16) \
- + ((uint32_t)TU_BIN8(db3)<<8) \
- + TU_BIN8(dlsb))
-#endif
+#define TU_BIT(n) (1U << (n))
// for declaration of reserved field, make use of _TU_COUNTER_
-#define TU_RESERVED XSTRING_CONCAT_(reserved, _TU_COUNTER_)
+#define TU_RESERVED XSTRING_CONCAT_(reserved, _TU_COUNTER_)
//--------------------------------------------------------------------+
// INCLUDES
@@ -113,54 +75,28 @@
#include "tusb_option.h"
#include "tusb_compiler.h"
#include "tusb_verify.h"
-#include "tusb_error.h"
+#include "tusb_error.h" // TODO remove
#include "tusb_timeout.h"
#include "tusb_types.h"
//--------------------------------------------------------------------+
// INLINE FUNCTION
//--------------------------------------------------------------------+
-#ifndef __n2be_16 // TODO clean up
-#define __n2be_16(u16) ((uint16_t) ((U16_LOW_U8(u16) << 8) | U16_HIGH_U8(u16)) )
-#define __be2n_16(u16) __n2be_16(u16)
-#endif
-
#define tu_memclr(buffer, size) memset((buffer), 0, (size))
#define tu_varclr(_var) tu_memclr(_var, sizeof(*(_var)))
-static inline bool tu_mem_test_zero (void const* buffer, uint32_t size)
-{
- uint8_t const* p_mem = (uint8_t const*) buffer;
- for(uint32_t i=0; i> 8)) & 0x00ff);
-}
-
-static inline uint8_t tu_u16_low(uint16_t u16)
-{
- return (uint8_t) (u16 & 0x00ff);
-}
-
-static inline uint16_t tu_u16_le2be(uint16_t u16)
-{
- return ((uint16_t)(tu_u16_low(u16) << 8)) | tu_u16_high(u16);
-}
+static inline uint8_t tu_u16_high(uint16_t u16) { return (uint8_t) (((uint16_t) (u16 >> 8)) & 0x00ff); }
+static inline uint8_t tu_u16_low (uint16_t u16) { return (uint8_t) (u16 & 0x00ff); }
// Min
static inline uint8_t tu_min8 (uint8_t x, uint8_t y ) { return (x < y) ? x : y; }
@@ -175,9 +111,7 @@ static inline uint32_t tu_max32 (uint32_t x, uint32_t y) { return (x > y) ? x :
// Align
static inline uint32_t tu_align32 (uint32_t value) { return (value & 0xFFFFFFE0UL); }
static inline uint32_t tu_align16 (uint32_t value) { return (value & 0xFFFFFFF0UL); }
-static inline uint32_t tu_align_n (uint32_t alignment, uint32_t value) { return value & ((uint32_t) ~(alignment-1)); }
static inline uint32_t tu_align4k (uint32_t value) { return (value & 0xFFFFF000UL); }
-
static inline uint32_t tu_offset4k(uint32_t value) { return (value & 0xFFFUL); }
//------------- Mathematics -------------//
@@ -190,7 +124,7 @@ static inline bool tu_within(uint32_t lower, uint32_t value, uint32_t upper)
}
// log2 of a value is its MSB's position
-// TODO use clz
+// TODO use clz TODO remove
static inline uint8_t tu_log2(uint32_t value)
{
uint8_t result = 0;
@@ -203,9 +137,9 @@ static inline uint8_t tu_log2(uint32_t value)
}
// Bit
-static inline uint32_t tu_bit_set(uint32_t value, uint8_t n) { return value | TU_BIT(n); }
+static inline uint32_t tu_bit_set (uint32_t value, uint8_t n) { return value | TU_BIT(n); }
static inline uint32_t tu_bit_clear(uint32_t value, uint8_t n) { return value & (~TU_BIT(n)); }
-static inline bool tu_bit_test(uint32_t value, uint8_t n) { return (value & TU_BIT(n)) ? true : false; }
+static inline bool tu_bit_test (uint32_t value, uint8_t n) { return (value & TU_BIT(n)) ? true : false; }
/*------------------------------------------------------------------*/
/* Count number of arguments of __VA_ARGS__
@@ -237,6 +171,35 @@ static inline bool tu_bit_test(uint32_t value, uint8_t n) { return (value & TU_B
9,8,7,6,5,4,3,2,1,0
#endif
+// To be removed
+//------------- Binary constant -------------//
+#if defined(__GNUC__) && !defined(__CC_ARM)
+
+#define TU_BIN8(x) ((uint8_t) (0b##x))
+#define TU_BIN16(b1, b2) ((uint16_t) (0b##b1##b2))
+#define TU_BIN32(b1, b2, b3, b4) ((uint32_t) (0b##b1##b2##b3##b4))
+
+#else
+
+// internal macro of B8, B16, B32
+#define _B8__(x) (((x&0x0000000FUL)?1:0) \
+ +((x&0x000000F0UL)?2:0) \
+ +((x&0x00000F00UL)?4:0) \
+ +((x&0x0000F000UL)?8:0) \
+ +((x&0x000F0000UL)?16:0) \
+ +((x&0x00F00000UL)?32:0) \
+ +((x&0x0F000000UL)?64:0) \
+ +((x&0xF0000000UL)?128:0))
+
+#define TU_BIN8(d) ((uint8_t) _B8__(0x##d##UL))
+#define TU_BIN16(dmsb,dlsb) (((uint16_t)TU_BIN8(dmsb)<<8) + TU_BIN8(dlsb))
+#define TU_BIN32(dmsb,db2,db3,dlsb) \
+ (((uint32_t)TU_BIN8(dmsb)<<24) \
+ + ((uint32_t)TU_BIN8(db2)<<16) \
+ + ((uint32_t)TU_BIN8(db3)<<8) \
+ + TU_BIN8(dlsb))
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/common/tusb_compiler.h b/src/common/tusb_compiler.h
index 613db4d3..0978d1c0 100644
--- a/src/common/tusb_compiler.h
+++ b/src/common/tusb_compiler.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -43,27 +43,41 @@
#define _TU_COUNTER_ __LINE__
#endif
-//--------------------------------------------------------------------+
-// Compile-time Assert (use TU_VERIFY_STATIC to avoid name conflict)
-//--------------------------------------------------------------------+
+// Compile-time Assert
#if __STDC_VERSION__ >= 201112L
#define TU_VERIFY_STATIC _Static_assert
#else
#define TU_VERIFY_STATIC(const_expr, _mess) enum { XSTRING_CONCAT_(_verify_static_, _TU_COUNTER_) = 1/(!!(const_expr)) }
#endif
-// allow debugger to watch any module-wide variables anywhere
-#if CFG_TUSB_DEBUG
-#define STATIC_VAR
-#else
-#define STATIC_VAR static
-#endif
-
-
+//--------------------------------------------------------------------+
+// Compiler porting with Attribute and Endian
+//--------------------------------------------------------------------+
#if defined(__GNUC__)
- #include "compiler/tusb_compiler_gcc.h"
-#elif defined __ICCARM__
- #include "compiler/tusb_compiler_iar.h"
+ #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
+ #define ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name)))
+ #define ATTR_PACKED __attribute__ ((packed))
+ #define ATTR_PREPACKED
+ #define ATTR_WEAK __attribute__ ((weak))
+ #define ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
+ #define ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
+
+ // Endian conversion use well-known host to network (big endian) naming
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ #define tu_htonl(u32) __builtin_bswap32(u32)
+ #define tu_ntohl(u32) __builtin_bswap32(u32)
+
+ #define tu_htons(u16) __builtin_bswap16(u16)
+ #define tu_ntohs(u16) __builtin_bswap16(u16)
+ #else
+ #define tu_htonl(u32) (u32)
+ #define tu_ntohl(u32) (u32)
+
+ #define tu_htons(u16) (u16)
+ #define tu_ntohs(u16) (u16)
+ #endif
+#else
+ #error "Compiler attribute porting are required"
#endif
#endif /* _TUSB_COMPILER_H_ */
diff --git a/src/common/tusb_error.h b/src/common/tusb_error.h
index 8dbfb0a5..e6313f7a 100644
--- a/src/common/tusb_error.h
+++ b/src/common/tusb_error.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index cdaa4ca7..e2ed51cd 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h
index b6fd3a70..1b64f1db 100644
--- a/src/common/tusb_fifo.h
+++ b/src/common/tusb_fifo.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/common/tusb_timeout.h b/src/common/tusb_timeout.h
index 83a4dac6..558742ff 100644
--- a/src/common/tusb_timeout.h
+++ b/src/common/tusb_timeout.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index 82b5a65c..78653384 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/common/tusb_verify.h b/src/common/tusb_verify.h
index 74bc4123..eecc95cc 100644
--- a/src/common/tusb_verify.h
+++ b/src/common/tusb_verify.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -46,11 +46,10 @@
extern "C" {
#endif
-
//--------------------------------------------------------------------+
// TU_VERIFY Helper
//--------------------------------------------------------------------+
-#if CFG_TUSB_DEBUG >= 1
+#if CFG_TUSB_DEBUG
#include
#define _MESS_ERR(_err) printf("%s: %d: failed, error = %s\n", __func__, __LINE__, tusb_strerr[_err])
#define _MESS_FAILED() printf("%s: %d: failed\n", __func__, __LINE__)
diff --git a/src/device/dcd.h b/src/device/dcd.h
index 18678f15..35164ac6 100644
--- a/src/device/dcd.h
+++ b/src/device/dcd.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 6e3a1e1c..56d89538 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -382,7 +382,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
break;
case TUSB_REQ_GET_DESCRIPTOR:
- TU_ASSERT( process_get_descriptor(rhport, p_request) );
+ TU_VERIFY( process_get_descriptor(rhport, p_request) );
break;
case TUSB_REQ_SET_FEATURE:
@@ -739,7 +739,7 @@ void usbd_edpt_stall(uint8_t rhport, uint8_t ep_addr)
uint8_t const dir = tu_edpt_dir(ep_addr);
dcd_edpt_stall(rhport, ep_addr);
- _usbd_dev.ep_stall_mask[dir] = tu_bit_set(_usbd_dev.ep_stall_mask[dir], epnum);
+ _usbd_dev.ep_stall_mask[dir] = (uint8_t) tu_bit_set(_usbd_dev.ep_stall_mask[dir], epnum);
}
void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr)
@@ -748,7 +748,7 @@ void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr)
uint8_t const dir = tu_edpt_dir(ep_addr);
dcd_edpt_clear_stall(rhport, ep_addr);
- _usbd_dev.ep_stall_mask[dir] = tu_bit_clear(_usbd_dev.ep_stall_mask[dir], epnum);
+ _usbd_dev.ep_stall_mask[dir] = (uint8_t) tu_bit_clear(_usbd_dev.ep_stall_mask[dir], epnum);
}
bool usbd_edpt_stalled(uint8_t rhport, uint8_t ep_addr)
diff --git a/src/device/usbd.h b/src/device/usbd.h
index 2e34b25a..46143a21 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -94,7 +94,7 @@ ATTR_WEAK void tud_resume_cb(void);
#define TUD_CONFIG_DESC_LEN (9)
-// Inteface count, string index, total length, attribute, power in mA
+// Interface count, string index, total length, attribute, power in mA
#define TUD_CONFIG_DESCRIPTOR(_itfcount, _stridx, _total_len, _attribute, _power_ma) \
9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, 1, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2
diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c
index 0b878fbc..1b5ee9f9 100644
--- a/src/device/usbd_control.c
+++ b/src/device/usbd_control.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/device/usbd_pvt.h b/src/device/usbd_pvt.h
index fb367235..f2053262 100644
--- a/src/device/usbd_pvt.h
+++ b/src/device/usbd_pvt.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c
index 348d1094..2973c689 100644
--- a/src/host/ehci/ehci.c
+++ b/src/host/ehci/ehci.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/ehci/ehci.h b/src/host/ehci/ehci.h
index f3247b1e..f64c58a0 100644
--- a/src/host/ehci/ehci.h
+++ b/src/host/ehci/ehci.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/hcd.h b/src/host/hcd.h
index 18cd356d..86e7d664 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/hub.c b/src/host/hub.c
index 157a7793..cc440086 100644
--- a/src/host/hub.c
+++ b/src/host/hub.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -44,8 +44,8 @@ typedef struct
uint8_t status_change; // data from status change interrupt endpoint
}usbh_hub_t;
-CFG_TUSB_MEM_SECTION STATIC_VAR usbh_hub_t hub_data[CFG_TUSB_HOST_DEVICE_MAX];
-ATTR_ALIGNED(4) CFG_TUSB_MEM_SECTION STATIC_VAR uint8_t hub_enum_buffer[sizeof(descriptor_hub_desc_t)];
+CFG_TUSB_MEM_SECTION static usbh_hub_t hub_data[CFG_TUSB_HOST_DEVICE_MAX];
+ATTR_ALIGNED(4) CFG_TUSB_MEM_SECTION static uint8_t hub_enum_buffer[sizeof(descriptor_hub_desc_t)];
//OSAL_SEM_DEF(hub_enum_semaphore);
//static osal_semaphore_handle_t hub_enum_sem_hdl;
@@ -83,7 +83,7 @@ bool hub_port_clear_feature_subtask(uint8_t hub_addr, uint8_t hub_port, uint8_t
hub_port_status_response_t * p_port_status;
p_port_status = (hub_port_status_response_t *) hub_enum_buffer;
- TU_ASSERT( !TU_BIT_TEST(p_port_status->status_change.value, feature-16) );
+ TU_ASSERT( !tu_bit_test(p_port_status->status_change.value, feature-16) );
return true;
}
@@ -211,7 +211,7 @@ void hub_isr(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xf
for (uint8_t port=1; port <= p_hub->port_number; port++)
{
// TODO HUB ignore bit0 hub_status_change
- if ( TU_BIT_TEST(p_hub->status_change, port) )
+ if ( tu_bit_test(p_hub->status_change, port) )
{
hcd_event_t event =
{
diff --git a/src/host/hub.h b/src/host/hub.h
index 5a4a5eb7..0182337b 100644
--- a/src/host/hub.h
+++ b/src/host/hub.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/ohci/ohci.c b/src/host/ohci/ohci.c
index 687279b7..e22f04f9 100644
--- a/src/host/ohci/ohci.c
+++ b/src/host/ohci/ohci.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/ohci/ohci.h b/src/host/ohci/ohci.h
index 0eaaacf6..ec35edf1 100644
--- a/src/host/ohci/ohci.h
+++ b/src/host/ohci/ohci.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 60d7afa7..7dcb5920 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/usbh.h b/src/host/usbh.h
index b8d15305..a0955e9f 100644
--- a/src/host/usbh.h
+++ b/src/host/usbh.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/host/usbh_hcd.h b/src/host/usbh_hcd.h
index 16116e9c..01be8285 100644
--- a/src/host/usbh_hcd.h
+++ b/src/host/usbh_hcd.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/osal/osal.h b/src/osal/osal.h
index 7304fdbd..ea655d4f 100644
--- a/src/osal/osal.h
+++ b/src/osal/osal.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/osal/osal_freertos.h b/src/osal/osal_freertos.h
index 215f7bca..240206e3 100644
--- a/src/osal/osal_freertos.h
+++ b/src/osal/osal_freertos.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/osal/osal_mynewt.h b/src/osal/osal_mynewt.h
index 6f3d0532..da7977d3 100644
--- a/src/osal/osal_mynewt.h
+++ b/src/osal/osal_mynewt.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h
index 02106417..7780345d 100644
--- a/src/osal/osal_none.h
+++ b/src/osal/osal_none.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 53f92bb1..37b5459f 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -375,7 +375,7 @@ void USBD_IRQHandler(void)
for(uint8_t i=0; iEPOUT[epnum].AMOUNT;
@@ -517,7 +517,7 @@ void USBD_IRQHandler(void)
// CBI In: Endpoint -> Host (transaction complete)
for(uint8_t epnum=0; epnum<8; epnum++)
{
- if ( TU_BIT_TEST(data_status, epnum ) || ( epnum == 0 && is_control_in) )
+ if ( tu_bit_test(data_status, epnum ) || ( epnum == 0 && is_control_in) )
{
xfer_td_t* xfer = get_td(epnum, TUSB_DIR_IN);
@@ -538,7 +538,7 @@ void USBD_IRQHandler(void)
// CBI OUT: Host -> Endpoint
for(uint8_t epnum=0; epnum<8; epnum++)
{
- if ( TU_BIT_TEST(data_status, 16+epnum ) || ( epnum == 0 && is_control_out) )
+ if ( tu_bit_test(data_status, 16+epnum ) || ( epnum == 0 && is_control_out) )
{
xfer_td_t* xfer = get_td(epnum, TUSB_DIR_OUT);
diff --git a/src/portable/nordic/nrf5x/hal_nrf5x.c b/src/portable/nordic/nrf5x/hal_nrf5x.c
index a90fba98..398f201e 100644
--- a/src/portable/nordic/nrf5x/hal_nrf5x.c
+++ b/src/portable/nordic/nrf5x/hal_nrf5x.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c b/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c
index fff29d5e..b63bf1fe 100644
--- a/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c
+++ b/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -279,7 +279,7 @@ static void process_xfer_isr(uint32_t int_status)
{
for(uint8_t ep_id = 0; ep_id < EP_COUNT; ep_id++ )
{
- if ( TU_BIT_TEST(int_status, ep_id) )
+ if ( tu_bit_test(int_status, ep_id) )
{
ep_cmd_sts_t * ep_cs = &_dcd.ep[ep_id][0];
xfer_dma_t* xfer_dma = &_dcd.dma[ep_id];
@@ -354,7 +354,7 @@ void USB_IRQHandler(void)
}
// Setup Receive
- if ( TU_BIT_TEST(int_status, 0) && (dev_cmd_stat & CMDSTAT_SETUP_RECEIVED_MASK) )
+ if ( tu_bit_test(int_status, 0) && (dev_cmd_stat & CMDSTAT_SETUP_RECEIVED_MASK) )
{
// Follow UM flowchart to clear Active & Stall on both Control IN/OUT endpoints
_dcd.ep[0][0].active = _dcd.ep[1][0].active = 0;
@@ -368,7 +368,7 @@ void USB_IRQHandler(void)
_dcd.ep[0][1].buffer_offset = get_buf_offset(_dcd.setup_packet);
// clear bit0
- int_status = TU_BIT_CLEAR(int_status, 0);
+ int_status = tu_bit_clear(int_status, 0);
}
// Endpoint transfer complete interrupt
diff --git a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
index 30252f56..a14d20e3 100644
--- a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
+++ b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -530,7 +530,7 @@ void hal_dcd_isr(uint8_t rhport)
{
for ( uint8_t ep_id = 3; ep_id < DCD_ENDPOINT_MAX; ep_id += 2 )
{
- if ( TU_BIT_TEST(ep_int_status, ep_id) )
+ if ( tu_bit_test(ep_int_status, ep_id) )
{
LPC_USB->EpIntClr = TU_BIT(ep_id);
@@ -553,7 +553,7 @@ void hal_dcd_isr(uint8_t rhport)
for ( uint8_t ep_id = 2; ep_id < DCD_ENDPOINT_MAX; ep_id++ )
{
- if ( TU_BIT_TEST(eot, ep_id) )
+ if ( tu_bit_test(eot, ep_id) )
{
if ( ep_id & 0x01 )
{
diff --git a/src/portable/nxp/lpc17_40/dcd_lpc17_40.h b/src/portable/nxp/lpc17_40/dcd_lpc17_40.h
index c834e470..1e7c0fbc 100644
--- a/src/portable/nxp/lpc17_40/dcd_lpc17_40.h
+++ b/src/portable/nxp/lpc17_40/dcd_lpc17_40.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/nxp/lpc17_40/hal_lpc17_40.c b/src/portable/nxp/lpc17_40/hal_lpc17_40.c
index cc9345e8..e83e3e9a 100644
--- a/src/portable/nxp/lpc17_40/hal_lpc17_40.c
+++ b/src/portable/nxp/lpc17_40/hal_lpc17_40.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c
index 5c2d27d9..89dc98ce 100644
--- a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c
+++ b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -341,7 +341,7 @@ void hal_dcd_isr(uint8_t rhport)
{
for(uint8_t ep_idx = 0; ep_idx < QHD_MAX; ep_idx++)
{
- if ( TU_BIT_TEST(edpt_complete, ep_idx2bit(ep_idx)) )
+ if ( tu_bit_test(edpt_complete, ep_idx2bit(ep_idx)) )
{
// 23.10.12.3 Failed QTD also get ENDPTCOMPLETE set
dcd_qtd_t * p_qtd = &dcd_data_ptr[rhport]->qtd[ep_idx];
diff --git a/src/portable/nxp/lpc18_43/dcd_lpc18_43.h b/src/portable/nxp/lpc18_43/dcd_lpc18_43.h
index ffd57c3f..00f4854b 100644
--- a/src/portable/nxp/lpc18_43/dcd_lpc18_43.h
+++ b/src/portable/nxp/lpc18_43/dcd_lpc18_43.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/nxp/lpc18_43/hal_lpc18_43.c b/src/portable/nxp/lpc18_43/hal_lpc18_43.c
index 31dbd962..3f4e9c23 100644
--- a/src/portable/nxp/lpc18_43/hal_lpc18_43.c
+++ b/src/portable/nxp/lpc18_43/hal_lpc18_43.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/nxp/lpc18_43/hcd_lpc18_43.c b/src/portable/nxp/lpc18_43/hcd_lpc18_43.c
index a622e0ab..cb509e7a 100644
--- a/src/portable/nxp/lpc18_43/hcd_lpc18_43.c
+++ b/src/portable/nxp/lpc18_43/hcd_lpc18_43.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/portable/st/stm32f3/dcd_stm32f3.c b/src/portable/st/stm32f3/dcd_stm32f3.c
index 02303747..648ff0e1 100644
--- a/src/portable/st/stm32f3/dcd_stm32f3.c
+++ b/src/portable/st/stm32f3/dcd_stm32f3.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/tusb.c b/src/tusb.c
index 825aa988..0f8eedd5 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/src/tusb.h b/src/tusb.h
index 122851b4..30642c00 100644
--- a/src/tusb.h
+++ b/src/tusb.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -101,20 +101,6 @@ bool tusb_inited(void);
// TODO
// bool tusb_teardown(void);
-
-// backward compatible only. TODO remove later
-ATTR_DEPRECATED("Please use either tud_task() or tuh_task()")
-static inline void tusb_task(void)
-{
- #if TUSB_OPT_HOST_ENABLED
- tuh_task();
- #endif
-
- #if TUSB_OPT_DEVICE_ENABLED
- tud_task();
- #endif
-}
-
/** @} */
#ifdef __cplusplus
diff --git a/src/tusb_option.h b/src/tusb_option.h
index 4e55132b..0f87ce66 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -119,13 +119,8 @@
//--------------------------------------------------------------------+
// COMMON OPTIONS
//--------------------------------------------------------------------+
-/**
- determines the debug level for the stack
- - Level 3: TBD
- - Level 2: TBD
- - Level 1: Print out if Assert failed. STATIC_VAR is NULL --> accessible when debugging
- - Level 0: no debug information is generated
-*/
+
+// Debug enable to print out error message
#ifndef CFG_TUSB_DEBUG
#define CFG_TUSB_DEBUG 0
#endif
diff --git a/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c b/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c
index c3cea912..628cc20d 100644
--- a/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c
+++ b/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc175x_6x/test/test_usbd.c b/tests/lpc175x_6x/test/test_usbd.c
index 374a919e..34d1251d 100644
--- a/tests/lpc175x_6x/test/test_usbd.c
+++ b/tests/lpc175x_6x/test/test_usbd.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h b/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h
index 800262cd..bac7963a 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h
+++ b/tests/lpc18xx_43xx/test/host/cdc/cdc_callback.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c
index d03d9e81..6fb7f450 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c
+++ b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h
index 2b95c835..410aee18 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h
+++ b/tests/lpc18xx_43xx/test/host/cdc/descriptor_cdc.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c
index 1b925282..1f7405ed 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c
+++ b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c
index e409a84f..81ebbc20 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c
+++ b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c
index faf01f05..fed02fb6 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c
index 0fca6046..61e2ea9c 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c
index e0a00ed1..ce637105 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c
index ee384c64..3a6b5b85 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c
index 9603b3a4..25f6cbdd 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c
index a229766e..fe0f8b5a 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c
index 0ffaa9b3..a17caae9 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c
index 5195b571..3abbc12b 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c
index 885c6136..045fa14b 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c
index da93a248..48e03d80 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c
index c0fcc88b..06c3e11b 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h b/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h
index ed8d4677..1154b023 100644
--- a/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h
+++ b/tests/lpc18xx_43xx/test/host/hid/hidh_callback.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c b/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c
index 7f3f4c0b..6b9545b2 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_generic.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_generic.c
index ce1af1b3..937a96f0 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_generic.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_generic.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c
index 8d0d236b..02b60f72 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c
index 20768aea..394b757e 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/host_helper.h b/tests/lpc18xx_43xx/test/host/host_helper.h
index fd3f11f3..16daac08 100644
--- a/tests/lpc18xx_43xx/test/host/host_helper.h
+++ b/tests/lpc18xx_43xx/test/host/host_helper.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/hub/test_hub.c b/tests/lpc18xx_43xx/test/host/hub/test_hub.c
index fadfd8ae..70db2b90 100644
--- a/tests/lpc18xx_43xx/test/host/hub/test_hub.c
+++ b/tests/lpc18xx_43xx/test/host/hub/test_hub.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/integration/test_hidh_keyboard_integrate.c b/tests/lpc18xx_43xx/test/host/integration/test_hidh_keyboard_integrate.c
index 1c7fcd2c..e019e8fd 100644
--- a/tests/lpc18xx_43xx/test/host/integration/test_hidh_keyboard_integrate.c
+++ b/tests/lpc18xx_43xx/test/host/integration/test_hidh_keyboard_integrate.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/msc/msch_callback.h b/tests/lpc18xx_43xx/test/host/msc/msch_callback.h
index 3e0a46e8..071e837e 100644
--- a/tests/lpc18xx_43xx/test/host/msc/msch_callback.h
+++ b/tests/lpc18xx_43xx/test/host/msc/msch_callback.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c b/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c
index 932f7a3c..a7e1b6c2 100644
--- a/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c
+++ b/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c
index cb61be89..bcc3ab8a 100644
--- a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c
+++ b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
index 2e9bcdc4..c09c17b3 100644
--- a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
+++ b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/test_assertion.c b/tests/lpc18xx_43xx/test/test_assertion.c
index 8ee877dd..15ede776 100644
--- a/tests/lpc18xx_43xx/test/test_assertion.c
+++ b/tests/lpc18xx_43xx/test/test_assertion.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/test_binary.c b/tests/lpc18xx_43xx/test/test_binary.c
index 2d2f6152..19b63d91 100644
--- a/tests/lpc18xx_43xx/test/test_binary.c
+++ b/tests/lpc18xx_43xx/test/test_binary.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/test_fifo.c b/tests/lpc18xx_43xx/test/test_fifo.c
index a45fe643..311f6f6d 100644
--- a/tests/lpc18xx_43xx/test/test_fifo.c
+++ b/tests/lpc18xx_43xx/test/test_fifo.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/test_osal_freeRTOS.c b/tests/lpc18xx_43xx/test/test_osal_freeRTOS.c
index c5bf1112..d39aa365 100644
--- a/tests/lpc18xx_43xx/test/test_osal_freeRTOS.c
+++ b/tests/lpc18xx_43xx/test/test_osal_freeRTOS.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/test_osal_none.c b/tests/lpc18xx_43xx/test/test_osal_none.c
index d26668c7..b6b4262d 100644
--- a/tests/lpc18xx_43xx/test/test_osal_none.c
+++ b/tests/lpc18xx_43xx/test/test_osal_none.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/lpc18xx_43xx/test/test_project_settings.c b/tests/lpc18xx_43xx/test/test_project_settings.c
index fdc296bf..60d9b684 100644
--- a/tests/lpc18xx_43xx/test/test_project_settings.c
+++ b/tests/lpc18xx_43xx/test/test_project_settings.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/support/descriptor_test.c b/tests/support/descriptor_test.c
index f4b1a6d1..b51c8171 100644
--- a/tests/support/descriptor_test.c
+++ b/tests/support/descriptor_test.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/support/descriptor_test.h b/tests/support/descriptor_test.h
index 38cb1782..4ec082ed 100644
--- a/tests/support/descriptor_test.h
+++ b/tests/support/descriptor_test.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/support/ehci_controller_fake.c b/tests/support/ehci_controller_fake.c
index cabb4402..710f0e61 100644
--- a/tests/support/ehci_controller_fake.c
+++ b/tests/support/ehci_controller_fake.c
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/support/ehci_controller_fake.h b/tests/support/ehci_controller_fake.h
index 53860608..7b21d6ca 100644
--- a/tests/support/ehci_controller_fake.h
+++ b/tests/support/ehci_controller_fake.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/support/tusb_callback.h b/tests/support/tusb_callback.h
index 48a779d0..3e793dd9 100644
--- a/tests/support/tusb_callback.h
+++ b/tests/support/tusb_callback.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/support/tusb_config.h b/tests/support/tusb_config.h
index 0c8957ff..000391ad 100644
--- a/tests/support/tusb_config.h
+++ b/tests/support/tusb_config.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -47,7 +47,7 @@
#define CFG_TUH_HID_KEYBOARD 1
#define CFG_TUH_HID_MOUSE 1
#define CFG_TUH_MSC 1
-#define CFG_TUSB_HOST_HID_GENERIC 0
+#define CFG_TUSB_HOST_HID_GENERIC 0
#define CFG_TUH_CDC 1
#define CFG_TUH_CDC_RNDIS 0
@@ -71,9 +71,9 @@
// COMMON CONFIGURATION
//--------------------------------------------------------------------+
-#define CFG_TUSB_DEBUG 3
+#define CFG_TUSB_DEBUG 1
-#define CFG_TUSB_OS OPT_OS_NONE
+#define CFG_TUSB_OS OPT_OS_NONE
#define CFG_TUSB_MEM_SECTION
#ifdef __cplusplus
diff --git a/tests/support/type_helper.h b/tests/support/type_helper.h
index 8d9d8c01..c836f244 100644
--- a/tests/support/type_helper.h
+++ b/tests/support/type_helper.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
- * Copyright (c) 2018, hathach (tinyusb.org)
+ * Copyright (c) 2019 Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/tools/build_all.py b/tools/build_all.py
index 37ca1443..4b0cf982 100644
--- a/tools/build_all.py
+++ b/tools/build_all.py
@@ -13,7 +13,11 @@ fail_count = 0
exit_status = 0
all_device_example = ["cdc_msc_hid", "msc_dual_lun", "hid_generic_inout"]
-all_boards = ["metro_m0_express", "metro_m4_express", "pca10056", "feather_nrf52840_express", "stm32f407g_disc1"]
+
+all_boards = []
+for entry in os.scandir("hw/bsp"):
+ if entry.is_dir():
+ all_boards.append(entry.name)
def build_example(example, board):
subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@@ -48,8 +52,9 @@ for example in all_device_example:
#board = 'pca10056'
#build_example(example, board)
-
total_time = time.monotonic() - total_time
+
+print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m".format(success_count, fail_count))
print("Total build time took {:.2f}s".format(total_time))
sys.exit(exit_status)