Skip to content

Commit

Permalink
Merge branch 'release/v2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jul 17, 2017
2 parents 65a6256 + 45aa38c commit 5b365ee
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 37 deletions.
2 changes: 1 addition & 1 deletion boards/teensy30.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"core": "teensy3",
"cpu": "cortex-m4",
"extra_flags": "-D__MK20DX128__ -DTEENSY30 -larm_cortexM4l_math",
"extra_flags": "-D__MK20DX128__ -DTEENSY30",
"f_cpu": "48000000L",
"ldscript": "mk20dx128.ld",
"mcu": "mk20dx128"
Expand Down
2 changes: 1 addition & 1 deletion boards/teensy31.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"core": "teensy3",
"cpu": "cortex-m4",
"extra_flags": "-D__MK20DX256__ -DTEENSY31 -larm_cortexM4l_math",
"extra_flags": "-D__MK20DX256__ -DTEENSY31",
"f_cpu": "72000000L",
"ldscript": "mk20dx256.ld",
"mcu": "mk20dx256"
Expand Down
2 changes: 1 addition & 1 deletion boards/teensy35.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"core": "teensy3",
"cpu": "cortex-m4",
"extra_flags": "-D__MK64FX512__ -DTEENSY35 -larm_cortexM4lf_math",
"extra_flags": "-D__MK64FX512__ -DTEENSY35",
"f_cpu": "120000000L",
"ldscript": "mk64fx512.ld",
"mcu": "mk64fx512"
Expand Down
2 changes: 1 addition & 1 deletion boards/teensy36.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"core": "teensy3",
"cpu": "cortex-m4",
"extra_flags": "-D__MK66FX1M0__ -DTEENSY36 -larm_cortexM4lf_math",
"extra_flags": "-D__MK66FX1M0__ -DTEENSY36",
"f_cpu": "180000000L",
"ldscript": "mk66fx1m0.ld",
"mcu": "mk66fx1m0"
Expand Down
2 changes: 1 addition & 1 deletion boards/teensylc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"core": "teensy3",
"cpu": "cortex-m0plus",
"extra_flags": "-D__MKL26Z64__ -DTEENSYLC -larm_cortexM0l_math",
"extra_flags": "-D__MKL26Z64__ -DTEENSYLC",
"f_cpu": "48000000L",
"ldscript": "mkl26z64.ld",
"mcu": "mkl26z64"
Expand Down
13 changes: 13 additions & 0 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@
]
)


if "cortex-m" in env.BoardConfig().get("build.cpu", ""):
board = env.subst("$BOARD")
math_lib = "arm_cortex%s_math"
if board in ("teensy35", "teensy36"):
math_lib = math_lib % "M4lf"
elif board in ("teensy30", "teensy31"):
math_lib = math_lib % "M4l"
else:
math_lib = math_lib % "M0l"

env.Append(LIBS=[math_lib])

# Teensy 2.x Core
if env.BoardConfig().get("build.core") == "teensy":
env.Append(CPPPATH=[join(FRAMEWORK_DIR, "cores")])
Expand Down
2 changes: 1 addition & 1 deletion builder/frameworks/mbed
Submodule mbed updated 1 files
+154 −300 mbed.py
1 change: 1 addition & 0 deletions examples/mbed-events/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
platform = teensy
framework = mbed
board = teensy31
build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT
1 change: 1 addition & 0 deletions examples/mbed-rtos/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
platform = teensy
framework = mbed
board = teensy31
build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT
54 changes: 25 additions & 29 deletions examples/mbed-rtos/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
#include "mbed.h"
#include "rtos.h"

/*
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
*/
#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
#define STACK_SIZE DEFAULT_STACK_SIZE/4
#else
#define STACK_SIZE DEFAULT_STACK_SIZE
#endif

void print_char(char c = '*') {
printf("%c", c);
fflush(stdout);

Queue<uint32_t, 5> queue;

DigitalOut myled(LED1);

void queue_isr() {
queue.put((uint32_t*)2);
myled = !myled;
}

DigitalOut led1(LED1);
DigitalOut led2(LED2);

void led2_thread(void const *argument) {

void queue_thread(void const *args) {
while (true) {
led2 = !led2;
queue.put((uint32_t*)1);
Thread::wait(1000);
print_char();
}
}

int main() {
Thread thread(led2_thread, NULL, osPriorityNormal, STACK_SIZE);


int main (void) {
Thread thread(queue_thread);

Ticker ticker;
ticker.attach(queue_isr, 1.0);

while (true) {
led1 = !led1;
Thread::wait(500);
osEvent evt = queue.get();
if (evt.status != osEventMessage) {
printf("queue->get() returned %02x status\n\r", evt.status);
} else {
printf("queue->get() returned %d\n\r", evt.value.v);
}
}
}
}
4 changes: 2 additions & 2 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-teensy.git"
},
"version": "2.1.1",
"version": "2.2.0",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"https://sourceforge.net/projects/platformio-storage/files/packages/manifest.json/download",
Expand Down Expand Up @@ -47,7 +47,7 @@
"framework-mbed": {
"type": "framework",
"optional": true,
"version": "~3.142.0"
"version": "~4.146.0"
},
"tool-teensy": {
"type": "uploader",
Expand Down
4 changes: 4 additions & 0 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def configure_default_packages(self, variables, targets):
else:
toolchain = "toolchain-gccarmnoneeabi"
self.packages[toolchain]['optional'] = False

if "mbed" in variables.get("pioframework", []):
self.packages["toolchain-gccarmnoneeabi"][
'version'] = ">=1.60301.0"

return PlatformBase.configure_default_packages(
self, variables, targets)

0 comments on commit 5b365ee

Please sign in to comment.