2020年8月

使用到的 stlink 命令行工具
https://github.com/stlink-org/stlink

st-flash 烧录,读写芯片,擦除之类
st-info 主要获取芯片相关信息
st-util gdb调试的

在mac下推荐的安装方式如下:
brew install stlink

擦除芯片
./st-flash erase
2020-08-21T23:56:08 INFO common.c: F04x: 6 KiB SRAM, 16 KiB flash in at least 1 KiB pages.
Mass erasing

烧录
./st-flash write xxx.bin 0x8000000
file xxx.bin md5 checksum: f44aa7045a596c4693a908fc68a1972, stlink checksum: 0x0001ac10
2020-08-21T23:55:11 INFO common.c: Attempting to write 1220 (0x4c4) bytes to stm32 address: 134217728 (0x8000000)
2020-08-21T23:55:11 INFO common.c: Flash page at addr: 0x08000000 erased
2020-08-21T23:55:11 INFO common.c: Flash page at addr: 0x08000400 erased
2020-08-21T23:55:11 INFO common.c: Finished erasing 2 pages of 1024 (0x400) bytes
2020-08-21T23:55:11 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2020-08-21T23:55:11 INFO flash_loader.c: Successfully loaded flash loader in sram
2/2 pages written
2020-08-21T23:55:11 INFO common.c: Starting verification of write complete
2020-08-21T23:55:11 INFO common.c: Flash written and verified! jolly good!

import (
    "net/http"
    "strings"
    urlpkg "net/url"
)

url := "http://jenkins/job/test/buildWithParameters"
data := urlpkg.Values{}
data.Add("SERVER_NAME", "测试服")
data.Add("SERVER_URI", "refs/heads/master")
data.Add("CONFIG_URI", "refs/heads/master")

req, err := http.NewRequest("POST", url, strings.NewReader(data.Encode()))
if err != nil {
    panic(err.Error())
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.SetBasicAuth("wameidemao", "1151edd79316129baea8911ce078908130")
resp, err := http.DefaultClient.Do(req)

package main

import "github.com/rjeczalik/notify"
import "fmt"

func main() {
    // Make the channel buffered to ensure no event is dropped. Notify will drop
    // an event if the receiver is not able to keep up the sending pace.
    c := make(chan notify.EventInfo, 1)

    // Set up a watchpoint listening on events within current working directory.
    // Dispatch each create and remove events separately to c.
    if err := notify.Watch(".", c, notify.Create, notify.Write, notify.Rename, notify.Remove); err != nil {
        fmt.Println("Error:", err)
    }
    defer notify.Stop(c)

    // Block until an event is received.
    for ie := range c {

     fmt.Println("Got event:", ie)

    }
}