《Time-to-Market with Zephyr and Pigweed.pdf》由會員分享,可在線閱讀,更多相關《Time-to-Market with Zephyr and Pigweed.pdf(33頁珍藏版)》請在三個皮匠報告上搜索。
1、#EMBEDDEDOSSUMMITTime-to-Market with Zephyr,Pigweed,and FirebaseYuval Peress,GoogleEmail:Discord:yuval#5515GitHub:yperessIn both big and small companies(even personal projects)time is expensiveMaking a great product is hard,iterating on it is harderFirebase is great for user facing projects,I wouldn
2、t start a new project without it:remote configsfeature flagsanalytics(user engagement)crashlyticsPigweed bridges the gap for embedded applications wanting to get going quicklyCan we have both?Timelines are everythingWhats our product?Getting set upConfiguring loggingApplication logicTracking eventsR
3、emote config(A/B testing or feature rollout)Crash reportingLets build a product#EMBEDDEDOSSUMMITWhats our product?Inputs:Cadence(RPMs)Power(Watts)Speed(m/s)Gravity vector(climb gradient)Manual gear override(up/down gear shifts)Output:Gear selection(rear and front cassette)Automatic gear shifter for
4、cyclingA simple decision graph#EMBEDDEDOSSUMMITGetting set upmanifest:remotes:-name:zephyr url-base:https:/ -name:pigweed url-base:https:/ projects:-name:zephyr remote:zephyr revision:main import:true -name:pigweed remote:pigweed revision:mainCreate a west.yml#Enable C+CONFIG_CPP=yCONFIG_STD_CPP17=y
5、CONFIG_CPP_MAIN=ySelect kConfig values#include int main()LOG_INF(“Hello Zephyr logs”);return 0;main.ccEnvironment setup:On every run of west update:$./pigweed/bootstrap.shWhen you start working:$./pigweed/activate.shBuild:$west build-p-b$BOARD appBuilding#EMBEDDEDOSSUMMITConfiguring loggingExperimen
6、tal,details may change#Enable C+CONFIG_CPP=yCONFIG_STD_CPP17=yCONFIG_CPP_MAIN=y#Enable tokenized RPC loggingCONFIG_PIGWEED_LOG_TOKENIZED_RPC=ySelect kConfig valuesExperimental,details may changeCONFIG_PIGWEED_LOG_TOKENIZED_RPC enables by default tokenized logging.Pigweed logging is intercepting the
7、Zephyr logs tooPigweed generated a hash based token database for logsAll logs are put into a proto message LogEntryLog messages are sent via a service stream to the host on a common HDLC serverMessages can be decoded via python or webconsolePython:$python3-m pw_system.console-device/dev/ttyUSB1-toke
8、n-database build/database.csvWebconsoleWhat just happened?Experimental,details may change$python3-m pw_system.console -device/dev/ttyUSB0 -token-database build/database.csvDecoding(python)Experimental,details may change$cd pigweed/pw_web/webconsole$npm install-force$npm run devDecoding(Webconsole)Ex
9、perimental,details may changeThe generated database can be sharedDecoding can be done in:PythonC+TypeScript/JavaScriptJava(Android)Decoding(anywhere else)#EMBEDDEDOSSUMMITApplication logicExperimental,details may changeEnergy data will be placed in a buffer of q31_t valuesRange is-1,1Requires an int
10、8_t shift value for scalingGet the currently configured threshold(using RemoteConfig RPC)Iterate through the buffer&compare against thresholdOn gear shift,register eventAfter sensor processing#EMBEDDEDOSSUMMITTracking eventsExperimental,details may changeApplication logic passes event data to the Fi
11、rebaseEventsServicemessage FirebaseEventParam string key=1;oneof value int64 int_value=2;bool bool_value=3;string string_value=4;message FirebaseEvent string name=1;repeated FirebaseEventParam params=2;service FirebaseEventService rpc Listen(FirebaseEventRequest)returns(stream FirebaseEvent);Event l
12、ogging data pathExperimental,details may changeExperimental,details may changeSample of events in DebugView#EMBEDDEDOSSUMMITRemote config&A/B testingExperimental,details may changeHost passes config data to the FirebaseRemoteConfigServicemessage FirebaseRemoteConfig string key=1;oneof value int64 in
13、t_value=2;bool bool_value=3;string string_value=4;message FirebaseRemoteConfigResponse;service FirebaseRemoteConfigService rpc Set(stream FirebaseRemoteConfig)returns(FirebaseRemoteConfigResponse);Remote config data pathExperimental,details may change#EMBEDDEDOSSUMMITCrash reportingExperimental,deta
14、ils may changeIt should work like the events serviceOn crash,stack information is saved to persistent memoryOn host connection,flush the last crash event to the hostCrash reporting concepts#EMBEDDEDOSSUMMITPutting it all togetherUse RemoteConfig:to parameterize the algorithmswhen introducing new fea
15、tureswith A/B testing to check if a new configuration is betterUse events:to see common user journeys in the fieldto reproduce crashesto help inform your application logic and focus future investmentUse crashlytics:to understand when users are running into issuesto provide improved and more reliable
16、 user experienceAdd event logging for manual gear overrideGear switching algorithm will have a RemoteConfig downshift and upshift energy/rotation thresholdWhen we improve the algorithm(to include the gradient in the equation)we can put the new calculation behind a bool RemoteConfig for a slower rolloutIn our example#EMBEDDEDOSSUMMITQuestions?