Download - From Web Developer to Hardware Developer
From Web Developer To Hardware Developer
(1+2+3+…10 )
10
(1+2+3+..16) >> 4
1000000.10
= 100000
100000.010
= 100000
82
=1000.
10=
100.0 = 4
Workflow
Let’s Make A Change In Ruby
New Features Web
1. Cucumber / UI
2. Write a presenter / controller
3. Then maybe you write a model
4. Hopefully all tests pass
Start with a small test
How The Web Works
apache/nginx
Application Runtime
Your Code
Database
IIS
.NET Framework
Your Code
SqlServer
How Embedded Works
Event Loop
Interrupts are fast
static uint8_t handler_flag = FALSE;
__interrupt void handler(void){handler_flag = TRUE;}
static uint8_t handler_flag = FALSE;
__interrupt void handler(void){handler_flag = TRUE;}
void main(void){while(1){if (handler_flag){// do some stuffhandler_flag = FALSE;
}}}
Inputs
Blocking Code
apache/nginx
Application Runtime
Your Code
Database
void main(void){while(1){while(databaseWri
te){//Wait
}}}
Event Loop
__interrupt void write_callback(void){write_finished = TRUE;}
while(1){start_write();if(write_finished){// do something
}}}
Frameworks/Libraries
• Rails
• Bundler
• Cocoapods
• Pip/ez_install ?
No Training WheelsController
Model ViewConductor
Model Hardware
TDD and Embedded
• RSpec
• MiniTest
• Cucumber
• XCTest
https://pragprog.com/book/jgade/test-driven-development-for-embedded-c
Testing Off Target
It’s just memory
Conductor
Model Hardware
Conductor
Model Hardware Mock Hardware*
* Software Version Of Hardware
static uint8_t button_mock = 0x0;
void test_button_is_pressed(void){button_mock = 0x0;TEST_ASSERT_EQUAL(isButtonPressed(&button_mock), 1);}
int isButtonPressed(uint8_t *button_ptr){//some logic around button}
0
Finding Failures
Handling Memory
void do_some_process(uint8_t arg1, uint8_t arg2);
4 bytes
RTOS
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Scheduler
Job 1
Job 2
Job 3
Job 4
Job 5
Releases
$ git push origin masterCounting objects: 6, done.Delta compression using up to 4 threads.Compressing objects: 100% (5/5), done.Writing objects: 100% (6/6), 1.90 KiB | 0 bytes/s, done.Total 6 (delta 1), reused 0 (delta 0)To [email protected]:alexshenoy/my_project.git + 93aa517...334aee4 master -> master
• Compile Code
• Transfer it to a supplier
• Issue a change request to the supplier
• Ship new products
Where To Get Started
• Arduino
• SparkFun - SparkCore
• AdaFruit