50
Your brains are fried, time for a fairy tale A possible future of resource constrained software development Auto-Intern GmbH 1

A possible future of resource constrained software development

Embed Size (px)

Citation preview

Your brains are fried, time for a fairy tale

A possible future of resource constrained software development

Auto-Intern GmbH 1

Once upon a time there was doped silicon

Auto-Intern GmbH 2

Auto-Intern GmbH 3

Auto-Intern GmbH 4

Auto-Intern GmbH 5

Auto-Intern GmbH 6

Auto-Intern GmbH 7

Auto-Intern GmbH 8

Auto-Intern GmbH 9

Auto-Intern GmbH 10

while (1) {if (button_a_pushed()) {

do_action_a();}

}

button_a_pushed()

do_action_a()

Auto-Intern GmbH 11

while (1) {if (button_a_pushed()) {

do_action_a();}

}

button_a_pushed()

do_action_a()

Auto-Intern GmbH 12

while (1) {if (button_a_pushed()) {

do_action_a();}if (button_b_pushed()) {

do_action_b();}

}

button_a_pushed()

do_action_a()

do_action_b()

Auto-Intern GmbH 13

while (1) {if (button_a_pushed()) {

do_action_a();}if (button_b_pushed()) {

do_action_b();}if (button_c_pushed()) {

do_action_c();}if (button_d_pushed()) {

do_action_d();}

}

button_a_pushed()

do_action_a()

do_action_b()

Auto-Intern GmbH 14

while (1) {if (button_a_pushed()) {

do_action_a();}if (button_b_pushed()) {

do_action_b();}if (button_c_pushed()) {

do_action_c();}if (button_d_pushed()) {

do_action_d();}

}

button_a_pushed()

do_action_a()

do_action_b()

do_action_c()

Auto-Intern GmbH 15

while (1) {if (button_a_pushed()) {

do_action_a();}if (button_b_pushed()) {

do_action_b();}if (button_c_pushed()) {

do_action_c();}if (button_d_pushed()) {

do_action_d();}

}

do_action_a()+

do_action_b()+

do_action_c()+

do_action_d()<

button press frequency

Auto-Intern GmbH 16

Auto-Intern GmbH 17

while (1) {if (uart_received()) {

do_uart();}else if (button_b_pushed()) {

do_action_b();}else if (button_c_pushed()) {

do_action_c();}else if (button_d_pushed()) {

do_action_d();}

}

Auto-Intern GmbH 18

Auto-Intern GmbH 19

preemption

Auto-Intern GmbH 20

Auto-Intern GmbH 21

Auto-Intern GmbH 22

Auto-Intern GmbH 23

Auto-Intern GmbH 24

Auto-Intern GmbH 25

Auto-Intern GmbH 26

Navigate the perils of software documentation

Auto-Intern GmbH 27

…and find the magic macro

Auto-Intern GmbH 28

Auto-Intern GmbH 29

Auto-Intern GmbH 30

Auto-Intern GmbH 31

void on_button_a_pressed() {events.push_back(buttons::a);

}

while (1) {if (events.size() > 0) {

switch (events.back()) {case buttons::a: { break; }case buttons::b: { break; }case buttons::c: { break; }case buttons::d: { break; }};events.pop_back();

}}

std::deque<buttons> events; ?

Auto-Intern GmbH 32

Auto-Intern GmbH 33

Auto-Intern GmbH 34

Auto-Intern GmbH 35

void on_button_a_pressed() {events.push_back(buttons::a);

}

while (1) {if (events.size() > 0) {

switch (events.back()) {case buttons::a: { break; }case buttons::b: { break; }case buttons::c: { break; }case buttons::d: { break; }};events.pop_back();

}}

Auto-Intern GmbH 36

Auto-Intern GmbH 37

Auto-Intern GmbH 38

Auto-Intern GmbH 39

Auto-Intern GmbH 40

Auto-Intern GmbH 41

Auto-Intern GmbH 42

template<class _Other1, class _Other2,class = enable_if_t<is_constructible<_Ty1, _Other1>::value && is_constructible<_Ty2, _Other2>::value>,enable_if_t<is_convertible<_Other1, _Ty1>::value && is_convertible<_Other2, _Ty2>::value, int> = 0>_CONST_FUN pair(_Other1&& _Val1, _Other2&& _Val2)_NOEXCEPT_OP((is_nothrow_constructible<_Ty1, _Other1>::value && is_nothrow_constructible<_Ty2, _Other2>::value)): first(_STD forward<_Other1>(_Val1)),second(_STD forward<_Other2>(_Val2)){// construct from moved values}

template<class _Other1, class _Other2,class = enable_if_t<is_constructible<_Ty1, _Other1>::value && is_constructible<_Ty2, _Other2>::value>,enable_if_t<!is_convertible<_Other1, _Ty1>::value || !is_convertible<_Other2, _Ty2>::value, int> = 0>_CONST_FUN explicit pair(_Other1&& _Val1, _Other2&& _Val2)_NOEXCEPT_OP((is_nothrow_constructible<_Ty1, _Other1>::value&& is_nothrow_constructible<_Ty2, _Other2>::value)): first(_STD forward<_Other1>(_Val1)),second(_STD forward<_Other2>(_Val2)){// construct from moved values}

Auto-Intern GmbH 43

void on_button_a_pressed() {events.push_back(buttons::a);

}

while (1) {if (events.size() > 0) {

switch (events.back()) {case buttons::a: { break; }case buttons::b: { break; }case buttons::c: { break; }case buttons::d: { break; }};events.pop_back();

}}

We need more guarantees

• Tool analyzable (statically binding / no recursion)

• All memory allocation is a policy

• Shared state access is atomic

• ISR disabling guarantees

• All library code non blocking

Auto-Intern GmbH 44

Auto-Intern GmbH 45

Auto-Intern GmbH 46

Auto-Intern GmbH 47

Auto-Intern GmbH 48

Auto-Intern GmbH 49

Auto-Intern GmbH 50