mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'master' of github.com:mbedmicro/mbed
commit
601712595f
|
@ -16,16 +16,17 @@ DigitalOut led(LED1);
|
|||
|
||||
volatile int change_counter = 0;
|
||||
volatile bool changing_counter = false;
|
||||
volatile bool mutex_defect = false;
|
||||
|
||||
bool manipulate_protected_zone(const int thread_delay) {
|
||||
bool result = true;
|
||||
|
||||
stdio_mutex.lock(); // LOCK
|
||||
if (changing_counter == true) {
|
||||
print_char('e'); // if changing_counter is true access is not exclusively
|
||||
// 'e' stands for error. If changing_counter is true access is not exclusively
|
||||
print_char('e');
|
||||
result = false;
|
||||
notify_completion(false);
|
||||
exit(1);
|
||||
mutex_defect = true;
|
||||
}
|
||||
changing_counter = true;
|
||||
|
||||
|
@ -53,17 +54,19 @@ int main() {
|
|||
const int t3_delay = THREAD_DELAY * 3;
|
||||
Thread t2(test_thread, (void *)t2_delay);
|
||||
Thread t3(test_thread, (void *)t3_delay);
|
||||
bool result = true;
|
||||
|
||||
while (true) {
|
||||
// Thread 1 action
|
||||
Thread::wait(t1_delay);
|
||||
manipulate_protected_zone(t1_delay);
|
||||
if (change_counter >= SIGNALS_TO_EMIT) {
|
||||
if (change_counter >= SIGNALS_TO_EMIT or mutex_defect == true) {
|
||||
t2.terminate();
|
||||
t3.terminate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
notify_completion(result);
|
||||
fflush(stdout);
|
||||
notify_completion(!mutex_defect);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "test_env.h"
|
||||
#include "rtos.h"
|
||||
|
||||
#define THREAD_DELAY 100
|
||||
#define THREAD_DELAY 75
|
||||
#define SEMAPHORE_SLOTS 2
|
||||
#define SEM_CHANGES 100
|
||||
|
||||
|
@ -16,6 +16,7 @@ Semaphore two_slots(SEMAPHORE_SLOTS);
|
|||
|
||||
volatile int change_counter = 0;
|
||||
volatile int sem_counter = 0;
|
||||
volatile bool sem_defect = false;
|
||||
|
||||
void test_thread(void const *delay) {
|
||||
const int thread_delay = int(delay);
|
||||
|
@ -26,8 +27,7 @@ void test_thread(void const *delay) {
|
|||
const char msg = sem_lock_failed ? 'e' : sem_counter + '0';
|
||||
print_char(msg);
|
||||
if (sem_lock_failed) {
|
||||
notify_completion(false);
|
||||
exit(1);
|
||||
sem_defect = true;
|
||||
}
|
||||
Thread::wait(thread_delay);
|
||||
print_char('.');
|
||||
|
@ -46,10 +46,15 @@ int main (void) {
|
|||
Thread t3(test_thread, (void *)t3_delay);
|
||||
|
||||
while (true) {
|
||||
if (change_counter >= SEM_CHANGES) {
|
||||
notify_completion(true);
|
||||
if (change_counter >= SEM_CHANGES or sem_defect == true) {
|
||||
t1.terminate();
|
||||
t2.terminate();
|
||||
t3.terminate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
notify_completion(!sem_defect);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,17 +15,18 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
"""
|
||||
|
||||
import tempfile
|
||||
import re
|
||||
from os.path import join, exists, basename
|
||||
from shutil import rmtree
|
||||
import tempfile
|
||||
|
||||
from types import ListType
|
||||
from shutil import rmtree
|
||||
from os.path import join, exists, basename
|
||||
|
||||
from workspace_tools.utils import mkdir, run_cmd, run_cmd_ext
|
||||
from workspace_tools.toolchains import TOOLCHAIN_CLASSES
|
||||
from workspace_tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
|
||||
from workspace_tools.libraries import Library
|
||||
from workspace_tools.targets import TARGET_NAMES, TARGET_MAP
|
||||
from workspace_tools.libraries import Library
|
||||
from workspace_tools.toolchains import TOOLCHAIN_CLASSES
|
||||
|
||||
|
||||
def build_project(src_path, build_path, target, toolchain_name,
|
||||
|
|
|
@ -22,12 +22,27 @@ class HelloTest(DefaultTest):
|
|||
HELLO_WORLD = "Hello World\n"
|
||||
|
||||
def run(self):
|
||||
c = self.mbed.serial_read(len(self.HELLO_WORLD))
|
||||
c = self.mbed.serial_read(1)
|
||||
if c is None:
|
||||
self.print_result("ioerr_serial")
|
||||
return
|
||||
data_to_read = len(self.HELLO_WORLD)
|
||||
read_buffer = ''
|
||||
if c == '$': # target will printout TargetID e.g.: $$$$1040e649d5c09a09a3f6bc568adef61375c6
|
||||
#Read additional 39 bytes of TargetID
|
||||
if self.mbed.serial_read(39) is None:
|
||||
self.print_result("ioerr_serial")
|
||||
return
|
||||
else:
|
||||
data_to_read -= 1
|
||||
read_buffer += c
|
||||
c = self.mbed.serial_read(data_to_read)
|
||||
read_buffer += c
|
||||
if c is None:
|
||||
self.print_result("ioerr_serial")
|
||||
return
|
||||
stdout.write(c)
|
||||
if c == self.HELLO_WORLD: # Hello World received
|
||||
stdout.write(read_buffer)
|
||||
if read_buffer == self.HELLO_WORLD: # Hello World received
|
||||
self.print_result('success')
|
||||
else:
|
||||
self.print_result('failure')
|
||||
|
|
|
@ -22,7 +22,7 @@ from time import time
|
|||
from sys import stdout
|
||||
|
||||
class StdioTest(DefaultTest):
|
||||
PATTERN_INT_VALUE = "^Your value was: (-?\d+)"
|
||||
PATTERN_INT_VALUE = "Your value was: (-?\d+)"
|
||||
re_detect_int_value = re.compile(PATTERN_INT_VALUE)
|
||||
|
||||
def run(self):
|
||||
|
|
|
@ -32,7 +32,7 @@ class WaitusTest(DefaultTest):
|
|||
return
|
||||
if c == '$': # target will printout TargetID e.g.: $$$$1040e649d5c09a09a3f6bc568adef61375c6
|
||||
#Read additional 39 bytes of TargetID
|
||||
if not self.mbed.serial_read(39):
|
||||
if self.mbed.serial_read(39) is None:
|
||||
self.print_result("ioerr_serial")
|
||||
return
|
||||
c = self.mbed.serial_read(1) # Re-read first 'tick'
|
||||
|
|
|
@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
from os import stat, walk, remove
|
||||
from os import stat, walk
|
||||
from os.path import join, splitext, exists, relpath, dirname, basename, split
|
||||
from shutil import copyfile
|
||||
from copy import copy
|
||||
|
@ -23,12 +23,10 @@ from inspect import getmro
|
|||
from time import time
|
||||
|
||||
from workspace_tools.utils import run_cmd, mkdir, rel_path, ToolException, split_path
|
||||
from workspace_tools.patch import patch
|
||||
from workspace_tools.settings import BUILD_OPTIONS, MBED_ORG_USER
|
||||
|
||||
from multiprocessing import Pool, Manager, cpu_count
|
||||
from multiprocessing import Pool, cpu_count
|
||||
from time import sleep
|
||||
from pprint import pprint
|
||||
|
||||
import workspace_tools.hooks as hooks
|
||||
import re
|
||||
|
@ -58,7 +56,7 @@ def print_notify_verbose(event):
|
|||
elif event['type'] == 'cc':
|
||||
event['severity'] = event['severity'].title()
|
||||
event['file'] = basename(event['file'])
|
||||
event['mcu_name'] = "None"
|
||||
event['mcu_name'] = "None"
|
||||
event['toolchain'] = "None"
|
||||
event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown"
|
||||
event['toolchain_name'] = event['toolchain_name'].upper() if event['toolchain_name'] else "Unknown"
|
||||
|
@ -153,7 +151,7 @@ class Resources:
|
|||
self.linker_script = self.linker_script.replace('\\', '/')
|
||||
|
||||
def __str__(self):
|
||||
s = []
|
||||
s = []
|
||||
|
||||
for (label, resources) in (
|
||||
('Include Directories', self.inc_dirs),
|
||||
|
@ -242,7 +240,7 @@ class mbedToolchain:
|
|||
|
||||
self.mp_pool = None
|
||||
|
||||
def __exit__():
|
||||
def __exit__(self):
|
||||
if self.mp_pool is not None:
|
||||
self.mp_pool.terminate()
|
||||
|
||||
|
@ -366,7 +364,7 @@ class mbedToolchain:
|
|||
elif ext == '.o':
|
||||
resources.objects.append(file_path)
|
||||
|
||||
elif ext == self.LIBRARY_EXT:
|
||||
elif ext == self.LIBRARY_EXT:
|
||||
resources.libraries.append(file_path)
|
||||
resources.lib_dirs.add(root)
|
||||
|
||||
|
@ -443,9 +441,9 @@ class mbedToolchain:
|
|||
if inc_dirs is not None:
|
||||
inc_paths.extend(inc_dirs)
|
||||
|
||||
objects=[]
|
||||
queue=[]
|
||||
prev_dir=None
|
||||
objects = []
|
||||
queue = []
|
||||
prev_dir = None
|
||||
|
||||
# The dependency checking for C/C++ is delegated to the compiler
|
||||
base_path = resources.base_path
|
||||
|
@ -692,7 +690,8 @@ class mbedToolchain:
|
|||
|
||||
|
||||
from workspace_tools.toolchains.arm import ARM_STD, ARM_MICRO
|
||||
from workspace_tools.toolchains.gcc import GCC_ARM, GCC_CS, GCC_CR, GCC_CW_EWL, GCC_CW_NEWLIB
|
||||
from workspace_tools.toolchains.gcc import GCC_ARM, GCC_CS, GCC_CR
|
||||
from workspace_tools.toolchains.gcc import GCC_CW_EWL, GCC_CW_NEWLIB
|
||||
from workspace_tools.toolchains.iar import IAR
|
||||
|
||||
TOOLCHAIN_CLASSES = {
|
||||
|
|
Loading…
Reference in New Issue