AVRやってましたがARMの性能が必要になってきたのでARMはじめます。
ARM toolchainのインストール
http://cu.rious.org/make/stm32-toolchain-on-mac-os-x/
st-linkのインストール
http://cu.rious.org/make/getting-stlink-to-work-on-mac-os-x-with-macports/
./autoconf が走らないので調べるとMakefileがおかしいらしい。
http://triode.dip.jp/honkytonk/category/electronicworks/stm32l-discovery
以下をMakefileとして保存して、再度autoconfすると通った。
# make ... for both stlink v1 and stlink v2 support ## VPATH=src SOURCES_LIB=stlink-common.c stlink-usb.c stlink-sg.c uglylogging.c OBJS_LIB=$(SOURCES_LIB:.c=.o) TEST_PROGRAMS=test_usb test_sg LDFLAGS=-L. -lstlink # libusb location LDFLAGS+=`pkg-config --libs libusb-1.0` CFLAGS+=`pkg-config --cflags libusb-1.0` CFLAGS+=-g CFLAGS+=-DDEBUG=1 CFLAGS+=-std=gnu99 CFLAGS+=-Wall -Wextra LIBRARY=libstlink.a all: $(LIBRARY) flash gdbserver $(TEST_PROGRAMS) $(LIBRARY): $(OBJS_LIB) @echo "objs are $(OBJS_LIB)" $(AR) -cr $@ $^ @echo "done making library" test_sg: test_sg.o $(LIBRARY) @echo "building test_sg" $(CC) test_sg.o $(LDFLAGS) -o $@ test_usb: test_usb.o $(LIBRARY) @echo "building test_usb" $(CC) test_usb.o $(LDFLAGS) -o $@ @echo "done linking" %.o: %.c @echo "building $^ into $@" $(CC) $(CFLAGS) -c $^ -o $@ @echo "done compiling" clean: rm -rf $(OBJS_LIB) rm -rf $(LIBRARY) rm -rf test_usb* rm -rf test_sg* $(MAKE) -C flash clean $(MAKE) -C gdbserver clean flash: $(MAKE) -C flash gdbserver: $(MAKE) -C gdbserver CONFIG_USE_LIBSG="$(CONFIG_USE_LIBSG)" .PHONY: clean all flash gdbserver
順番があってるかわからないけど、ARMのクロスコンパイラもインストール
http://triode.dip.jp/honkytonk/2012/05/electronicworks/stm32l-st-link_mac-osx.html
STM32discoveryをPCに挿した状態で次のコマンドを打ってみた。
@summon-arm-toolchain/stlink $ ./gdbserver/st-util 4242 usb non-option ARGV-elements: 4242 usb  2012-10-01T00:03:09 INFO src/stlink-common.c: Loading device parameters.... 2012-10-01T00:03:09 INFO src/stlink-common.c: Device connected is: F1 Medium-density Value Line device, id 0x10016420 2012-10-01T00:03:09 INFO src/stlink-common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes Chip ID is 00000420, Core ID is  1ba01477. KARL - should read back as 0x03, not 60 02 00 00 init watchpoints Listening at *:4242...
$ arm-none-eabi-gdb GNU gdb (GDB) 7.4.1 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i386-apple-darwin10.8.0 --target=arm-none-eabi". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb)
動いてる感じではある。何のことかはよくわかっていない。
ここも参考に。
http://4oc.blogspot.jp/2011/12/macstm8stm32.html
まだ不十分なようなので続きます。