Download python (2.7.10)
Archlinux :
pacman -S --noconfirm gcc # The GNU Compiler Collection - C and C++ frontends
pacman -S --noconfirm pkg-config # A system for managing library compile/link flags
pacman -S --noconfirm pixman # The pixel-manipulation library for X and cairo
pacman -S --noconfirm dtc # Open Firmware device tree compiler
pacman -S --noconfirm git # version control system
Ubuntu :
sudo apt-get install glibc* gthread* gcc dtc
Start to build:
Download QEMU with an STM32 microcontroller implementation (tar.gz)
git clone git://github.com/beckus/qemu_stm32.git
cd qemu_stm32 git submodule update --init dtc ./configure --disable-werror --enable-debug \ --target-list="arm-softmmu" \ --extra-cflags=-DDEBUG_CLKTREE \ --extra-cflags=-DDEBUG_STM32_RCC \ --extra-cflags=-DDEBUG_STM32_UART \ --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY \ --extra-cflags=-DSTM32_UART_ENABLE_OVERRUN \ --disable-gtk make
sudo make install
Download GCC for ARM(Download Point - gcc arm embedded)
Set the path of gcc compile tool
PATH=/tmp/test/gcc-arm-none-eabi-5_3-2016q1/bin:$PATH
Reference:
- How to install the ARM toolchain?
- How to Build a GCC Cross-Compiler
- How to build toolchain
- GNU ARM Embedded Toolchain gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2 (Binary)
gcc-arm-none-eabi-4_9-2015q2-20150609-src.tar.bz2 (Source Code)
Cross-Compiler: gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
Download mini-arm-os
git clone https://github.com/jserv/mini-arm-os.git
cd /home/happy/test/mini-arm-os/00-HelloWorld
make
Result:
arm-none-eabi-gcc -fno-common -O0 -mcpu=cortex-m3 -mthumb -T hello.ld -nostartfiles hello.c startup.c -o hello.elf
arm-none-eabi-objcopy -Obinary hello.elf hello.bin
arm-none-eabi-objdump -S hello.elf > hello.list
make qemu
Result :
STM32_UART: UART3 Baud is set to 0 bits per sec.
STM32_UART: UART2 clock is set to 0 Hz.
STM32_UART: UART2 BRR set to 0.
STM32_UART: UART2 Baud is set to 0 bits per sec.
STM32_UART: UART1 clock is set to 0 Hz.
STM32_UART: UART1 BRR set to 0.
STM32_UART: UART1 Baud is set to 0 bits per sec.
LED Off
CLKTREE: HSI Output Change (SrcClk:None InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: HSI/2 Output Change (SrcClk:HSI InFreq:8000000 OutFreq:4000000 Mul:1 Div:2 Enabled:1)
CLKTREE: SYSCLK Output Change (SrcClk:HSI InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: HCLK Output Change (SrcClk:SYSCLK InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
STM32_RCC: Cortex SYSTICK frequency set to 8000000 Hz (scale set to 125).
STM32_RCC: Cortex SYSTICK ext ref frequency set to 1000000 Hz (scale set to 1000).
CLKTREE: PCLK1 Output Change (SrcClk:HCLK InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: PCLK2 Output Change (SrcClk:HCLK InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: GPIOA Output Change (SrcClk:PCLK2 InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: AFIO Output Change (SrcClk:PCLK2 InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: UART2 Output Change (SrcClk:PCLK1 InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
STM32_UART: UART2 clock is set to 8000000 Hz.
STM32_UART: UART2 BRR set to 0.
STM32_UART: UART2 Baud is set to 0 bits per sec.
Hello World!
Next Chapter: [OS][mini-arm-os] 02-ContextSwitch-1
Reference:
- jserv/mini-arm-os
- STM32 on QEMU 環境建立與測試
- hackpad - Embedded2015
- Doc
- hackpad
- Youtube
0 意見:
張貼留言