View
522
Download
0
Category
Preview:
Citation preview
Your brains are fried, time for a fairy tale
A possible future of resource constrained software development
Auto-Intern GmbH 1
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 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 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 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 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
Recommended