遠程引腳期不再運行。感謝大家測試遠程Pinetime!
Remote PineTime是新加坡的Pinetime智能手錶,該手錶配置為允許世界上的任何人遠程閃爍和測試固件。
遠程Pinetime機器人(在Rust中創建)觀看一個電報組,用於閃爍命令,並將固件刷新到PineTime。
PINETIME上的顯示器已直播到YouTube,因此您可以在我的PineTime上觀看現場直播的固件。
要刷新自己的固件並測試PineTime,請加入“遠程Pinetime”電報組:https://t.me/remotepinetime
閃爍的日誌(來自OpenOCD)和調試消息日誌(來自ARM SEMIHOSTING)將在“遠程Pinetime Log”電報頻道中顯示:https://t.me/remotepinetimelog
在YouTube上觀看演示視頻
要閃爍固件二進製文件https://.../firmware.bin到pinetime在地址0x0 ...
/flash 0x0 https://.../firmware.bin
這適用於未登錄保護的任何URL。
不要通過GitHub Actions創建的工件傳遞URL。他們需要登錄,電報機器人將被阻止。
取而代之的是,在“釋放”下複製工件並將其上傳,該“版本”不受登錄保護。
PINETIME固件的某些口味需要引導加載程序,例如McUboot或SoftDevice。首先將引導程序刷新到地址0x0 ,然後刷新固件。
應刷新與McUboot兼容的固件地址0x8000
要在PineTime上進行閃光突破...
/flash 0x0 http://tt-392.space/breakout.hex
Pinetime中突破的演示視頻
要閃爍手繪手錶臉...
/flash 0x0 https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v5.0.4/mynewt.elf.bin
/flash 0x8000 https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v7.0.1/my_sensor_app.img
有關手繪手錶臉的更多信息
閃爍一個永不入睡的修改後的“吹”的無限固件...
/flash 0x0 https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v5.0.4/mynewt.elf.bin
/flash 0x8000 https://github.com/AntonMadness/Pinetime/releases/download/v0.1.1/pinetime-mcuboot-app-img.bin
通過編輯src/DisplayApp/DisplayApp.cpp來修改這一點,以刪除對case Messages::GoToSleep:
在Mynewt固件上閃爍生鏽,以排放半i的調試消息...
/flash 0x0 https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v5.0.4/mynewt.elf.bin
/flash 0x8000 https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v5.0.7/my_sensor_app.img
在騷亂上閃爍生鏽...
/flash 0x0 https://github.com/lupyuen/pinetime-rust-riot/releases/download/v1.0.3/PineTime.bin
閃爍McUboot Bootloader 5.0.4 ...
/flash 0x0 https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v5.0.4/mynewt.elf.bin
有時,由於固件錯誤,PineTime會被鎖定。刷新上述McUboot布洛彈器應修復鎖定。
要在網絡瀏覽器(不安裝任何IDE或工具鏈)中構建自己的固件,請查看文章...
用github動作在雲中構建Pinetime固件
使用WebAssembly的Web瀏覽器中的PineTime手錶面
電報中閃爍的外觀...
在YouTube上觀看演示視頻
在PineTime上有問題嗎?與矩陣 / Discord / Telegram / irc上的Pinetime社區聊天...
https://wiki.pine64.org/index.php/pinetime#community
查看我的Pinetime文章
因為在大流行期間,在世界範圍內運輸真正的硬件是困難且昂貴的……並且遠程固件測試可能是解決方案。
創建遠程PinEtime的目的是允許人們學習和嘗試智能手錶編碼而無需真正的智能手錶。
查看我的視頻演示...
Riot Summit 2020-更安全,更簡單的嵌入式程序,帶有Rust Riot
ARM SEMIHOSTING使我們的固件通過調用ARM Cortex-M指令bkpt來發出調試消息。
查看此實現此pinetime-rust-mynewt的ARM半旋轉的實現...
/// Send an ARM Semihosting command to the debugger, e.g. to print a message.
/// To see the message you need to run opencd:
/// openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -f scripts/debug.ocd
static int __semihost ( int command , void * message ) {
// Warning: This code will trigger a breakpoint and hang unless a debugger is connected.
// That's how ARM Semihosting sends a command to the debugger to print a message.
// This code MUST be disabled on production devices.
__asm(
"mov r0, %[cmd] n"
"mov r1, %[msg] n"
"bkpt #0xAB n"
: // Output operand list: (nothing)
: // Input operand list:
[ cmd ] "r" ( command ),
[ msg ] "r" ( message )
: // Clobbered register list:
"r0" , "r1" , "memory"
);
return 0 ;
}我們稱__semihost()為So: semihosting_console.c
/// ARM Semihosting Command
#define SYS_WRITE (0x5)
/// Write "length" number of bytes from "buffer" to the debugger's file handle fh.
/// We set fh=2 to write to the debugger's stderr output.
static int semihost_write ( uint32_t fh , const unsigned char * buffer , unsigned int length ) {
// If debugger is not connected, quit.
if (! debugger_connected ()) { return 0 ; }
if ( length == 0 ) { return 0 ; }
uint32_t args [ 3 ];
args [ 0 ] = ( uint32_t ) fh ;
args [ 1 ] = ( uint32_t ) buffer ;
args [ 2 ] = ( uint32_t ) length ;
return __semihost ( SYS_WRITE , args );
}
/// Return non-zero if debugger is connected. From repos/apache-mynewt-core/hw/mcu/ambiq/apollo2/src/hal_system.c
static int debugger_connected ( void ) {
return CoreDebug -> DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk ;
}當我們打電話...
/// Write "hellon" (6 characters) to the debugger's stderr output.
#define SEMIHOST_HANDLE 2
semihost_write ( SEMIHOST_HANDLE , ( const unsigned char * ) "hellon" , 6 );我們將看到消息hello出現在OpenOCD和Remote PineTime日誌中。 (消息必須以新線結尾,否則不會出現)
需要在OpenOCD中啟用ARM半旋轉。這是遠程PINETIME啟用ARM半旋轉的方式: flash-log.ocd
# Arm Semihosting is used to show debug console output and may only be enabled after the init event.
# We wait for the event and enable Arm Semihosting.
$_TARGETNAME configure -event reset-init {
echo "Enabled ARM Semihosting to show debug output"
arm semihosting enable
}
ARM半iPhost的速度可能很慢...整個微控制器凍結,而調試消息則通過字符通過SWD端口傳輸到OpenOCD。
我們建議使用靜態陣列在內存中緩衝傳出消息。
在ARM半播的pinetime-rust-mynewt實現中,我們使用MyNewt MBUFS有效地緩衝消息。
當藍牙LE處理正在進行時,請勿使用ARM半直靜止...將刪除消息,並且藍牙LE客戶端將自動斷開連接。
ARM半直螺旋應在生產固件中被禁用。另外,當連接JLINK調試器時,ARM半軸向可能會懸掛。對於pinetime-rust-mynewt我們在targets/nrf52_boot/pkg.yml中使用GCC FLAG -DDISABLE_SEMIHOSTING禁用ARM半軸,(用於McUboot Bootloader)和targets/nrf52_my_sensor/pkg.yml (用於應用程序固件)。
創建自己的電報機器人...
與Botfather聊天,創建一個名為PineTime Bot的機器人
輸入/mybots ,選擇PineTime Bot
選擇Edit Commands ,輸入flash - flash 0x0 https://.../firmware.bin
要運行自己的電報機器人:克隆此倉庫,然後在shell腳本中運行此回購...
# Set your Telegram Bot Token
export TELEGRAM_BOT_TOKEN= ???
# This is needed to fix the h2 / indexmap build error "ids: IndexMap<StreamId, SlabIndex> expected 3 type arguments"
export CARGO_FEATURE_STD=1
# Show Rust stack trace
export RUST_BACKTRACE=1
cd ~ /remote-pinetime-bot
for (( ; ; ))
do
git pull
pkill openocd
cargo run
echo " ---------ERROR-------- "
sleep 30
doneTelegram Bot將Pinetime Updater和XPACK OpenOCD調用閃光固件通過SWD將其命名為PineTime。
要下載Xpack OpenOCD(用於Mac)或OpenOCD SPI(對於Raspberry Pi),請查看pinetime-updater/run.sh
Telegram Bot當前使用Xpack OpenOCD(而不是OpenOCD SPI)在Raspberry Pi上運行。從這裡下載了32位Raspbian的Xpack OpenOCD
ST-Link的USB驅動程序像SO一樣在Raspbian上配置
# For Linux Only: Install UDEV Rules according to https://xpack.github.io/openocd/install/#udev
sudo cp xpack-openocd/contrib/60-openocd.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules要實時將Raspberry Pi攝像機流式傳輸到YouTube:在外殼腳本中運行此攝像機...
for (( ; ; ))
do
raspivid -n -o - -t 0 -vf -hf -fps 30 -b 6000000 |
ffmpeg -re -ar 44100 -ac 2
-acodec pcm_s16le -f s16le -ac 2
-i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental
-f flv rtmp://a.rtmp.youtube.com/live2/YOUR_YOUTUBE_STREAM_KEY
sleep 1
done基於https://www.makeuseof.com/tag/live-stream-youtube-raspberry-pi/
使用有線網絡連接而不是wifi ...因為打開微波爐會破壞2.4 GHz WiFi網絡並終止您的YouTube Live流。 (並且您的YouTube直播網址將改變)
這是帶有(從左到右)Raspberry Pi 4,Raspberry Pi V2攝像頭模塊(8 MP)的實時流式設置,兩個放大鏡,帶有Pogo Pin(尖端)和ST-Link V2的PineTime,Pintime Etiment
蓋上一個紙質的圍牆,以阻止放大鏡上的反射(如望遠鏡)...
如何製作紙質的圍欄...
放置覆盆子PI,攝像頭模塊,兩個放大鏡和PineTime
通過在Raspberry Pi,相機模塊和放大鏡上放置一個信封來建立腳手架
通過放置一塊A4大小的紙來完成腳手架
在腳手架上粘貼紙巾條,請務必覆蓋Raspbery Pi。我通過將半杯與半杯水混合在一起來創建糊狀物。
讓Papier-mâché乾燥過夜,形成外殼的形狀。用剪刀修剪紙紙。微波紙紙將其乾燥。
以有序的方式粘貼第二層紙巾條。
微波紙紙一分鐘,讓它冷卻。使用傾覆的碗來支撐結構。重複3次,直到紙紙乾燥為止。
用剪刀修剪紙紙圍欄。
是否有任何安全問題將電報機器人曝光到世界上進行閃爍和測試?
我們盡可能減輕安全風險...
我們的電報機器人是使用Rust(一種安全的系統編程語言)構建的。
在src/main.rs上查看Rust源代碼
不允許遠程訪問主機。電報機器人僅針對/flash命令進行輪詢並執行它們。
臨時文件將在tempfile庫使用後自動刪除。因此,我們通過惡意軟件減少文件的暴露。
但是有一個問題...我們的PineTime可能會閃爍著攻擊附近其他藍牙設備的惡意軟件。
為了物聯網教育...我允許它! :-)
我完全意識到當我經營這項免費服務時會有風險。而且,如果您選擇操作自己的遠程PineTime,則也應該知道風險。
關於半座支持的一個嚴重的安全問題:半旋律的API支持在OpenOCD主機(Raspberry PI)上閱讀,寫作和執行文件。
這個安全問題尚未解決。解決方法是禁用OpenOCD中的半host支持,這也將禁用調試消息。
將半台化調試日誌寫入單獨的電報頻道
油門將登錄到電報頻道的半iHosting消息的數量(匯總和將消息傳輸為單個電報請求每5秒鐘)
允許半台化的調試日誌和固件閃爍以共存(它們都使用OpenOCD)