"thank you for being interested in creative electronic music."

diydsp_log.png Join us -  We're making a journey into sound.

diydsp_log.png

Building Bitbox from Scratch Under Lubuntu 13.10

by DIYDSP

 

Make sure you have already installed gcc for the stm32f4.  There are several ways to do it, but I simply recommending the Ubuntu package manager.  It is currently supported in Lubuntu 13.10 ( written in September 2014).

First get the BitBox code

  313  git clone https://github.com/makapuf/bitbox.git

 

Now build 1st_boot

  315  cd bitbox/
  317  cd 1st_boot/

 

Now build 2nd_boot

  318  make
  319  cd ..

320  cd 2nd_boot/
 

Now install needed Python libraries

 

You will several python graphics libraries.  You have to have the zlib installed before you install pillow.  Otherwise mk_font.py may not work.

  323  sudo apt-get install python-pip
  328  sudo apt-get install python-dev

  353  sudo apt-get install libjpeg-dev
  354  sudo apt-get install zlib1g-dev
  355  sudo pip install pillow

 

Now, run mk_font.py

  360  python ./mk_font.py 8x16_437.png > bg.c

 

What Next?

Attempt to actually compile 2nd_boot:

  361  make

 

At this point, my build breaks because of "bg_data." 

Makefile:16: warning: overriding commands for target `stlink'
lib/bitbox.mk:120: warning: ignoring old commands for target `stlink'
arm-none-eabi-gcc  -mthumb -mcpu=cortex-m4 -nostartfiles -Wl,-T,Linker_2Bootloader.ld,--gc-sections -o 2nd_boot.elf build/2nd_boot.o build/font.o build/bg.o build/flashit.o build/startup.o build/system.o build/new_vga.o build/bitbox_main.o build/audio.o build/evt_queue.o build/stm32f4xx_gpio.o build/stm32f4xx_rcc.o build/stm32f4xx_tim.o build/misc.o build/usb_bsp.o build/usb_core.o build/usb_hcd.o build/usb_hcd_int.o build/usbh_core.o build/usbh_hcs.o build/usbh_hid_core.o build/usbh_hid_keybd.o build/usbh_hid_mouse.o build/usbh_hid_gamepad.o build/usbh_ioreq.o build/usbh_stdreq.o build/stm32fxxx_it.o build/fatfs/stm32f4_lowlevel.o build/fatfs/stm32f4_discovery_sdio_sd.o build/stm32f4xx_sdio.o build/stm32f4xx_dma.o build/fatfs/ff.o build/fatfs/diskio.o build/memcpy-armv7m.o -lm
build/2nd_boot.o: In function `game_line':
/home/nvawter/stm32f4/bitbox/bitbox/2nd_boot/2nd_boot.c:370: undefined reference to `bg_data'
collect2: error: ld returned 1 exit status
make: *** [2nd_boot.elf] Error 1

Ah I forgot to run mk_bg.py

 

But something goes wrong...  I don't actually know how to run mk_bg.py, but here is my guess:

 
nvawter@nvawter-System-Product-Name:~/stm32f4/bitbox/bitbox/2nd_boot$ python ./mk_bg.py 8x16_437.png 
/* *** File : 8x16_437.png *** */
#include <stdint.h>
const uint16_t bg_data[256] = {
  
Traceback (most recent call last):
  File "./mk_bg.py", line 15, in <module>
    print "0x%04x,"%((pix[0]>>3)<<10 | (pix[1]>>3)<<5 | (pix[2]>>3)),
TypeError: 'int' object has no attribute '__getitem__'













I don't know what to do at this point
asdf
asdf



nvawter@nvawter-System-Product-Name:~/stm32f4/bitbox/bitbox/2nd_boot$ more mk_bg.py
''' an utility to transform a pixmap to a 256 color bg palette'''

from PIL import Image
import sys

filename =  sys.argv[1] # '8x16_437.png'

print "/* *** File : %s *** */ "%filename
print "#include <stdint.h>"
print "const uint16_t bg_data[256] = {\n   ",
src = Image.open(filename)

for y in range(256) :
        pix = src.getpixel((0,y))
        print "0x%04x,"%((pix[0]>>3)<<10 | (pix[1]>>3)<<5 | (pix[2]>>3)),
        if (y%16)==15 : print "\n   ",
print "\n };"


 

At this point you might want to use SWD

 

Makapuf's SWD instructions are here:

Uploading to bitbox, Part 1

Uploading to bitbox, Part 2

 

Powered by liveSite