<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>none of this matters &#187; Programming</title>
	<atom:link href="http://blog.nemik.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nemik.net</link>
	<description></description>
	<lastBuildDate>Mon, 09 Jan 2012 23:55:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Building Energy Micro EFM32 binaries from OS X</title>
		<link>http://blog.nemik.net/2011/06/building-energy-micro-efm32-binaries-from-os-x/</link>
		<comments>http://blog.nemik.net/2011/06/building-energy-micro-efm32-binaries-from-os-x/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 04:09:40 +0000</pubDate>
		<dc:creator>nemik</dc:creator>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[arm ubuntu energy micro efm32 gdb jtag swd micrcontrollers openocd linux]]></category>

		<guid isPermaLink="false">http://blog.nemik.net/?p=101</guid>
		<description><![CDATA[I&#8217;m currently evaluating the EFM32 Gecko MCU from Energy Micro for a project. I&#8217;m using the Developer&#8217;s Kit with the EFM32G290F128 MCU. I mainly work in OS X and Linux and don&#8217;t much like having to boot up the Windows Virtual Machine to develop and debug firmwares. The tools mostly suck (I &#60;3 the CLI) [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently evaluating the EFM32 Gecko MCU from Energy Micro for a project. I&#8217;m using the Developer&#8217;s Kit with the EFM32G290F128 MCU.</p>
<p>I mainly work in OS X and Linux and don&#8217;t much like having to boot up the Windows Virtual Machine to develop and debug firmwares. The tools mostly suck (I &lt;3 the CLI) or are very expensive (often both). So I wanted a way to use open source tools like gcc, gdb and openocd.</p>
<p>First step was getting a binary to compile.</p>
<p>1. visit https://github.com/jsnyder/arm-eabi-toolchain and install as directed, make sure you run the make install-bin-extras after all the make-ing and make install-ing.</p>
<p>2. try a sample EFM32G firmware like the one included in the <a href="http://cdn.energymicro.com/dl/packages/DVK_BSP_1.6.1.zip">DVK_BSP_1.6.1.zip</a> copy the &#8216;blink&#8217; one to some directory of your choosing for this project.</p>
<p>3. Download the <a href="http://cdn.energymicro.com/dl/packages/EFM32_CMSIS_2.0.0.zip">EFM CMSIS Library</a> and copy it to the parent directory of the project directory you chose in step 2. Do the same with the &#8216;bsp&#8217; and &#8216;efm32lib&#8217; directories from the DVK_BSP.</p>
<p>4. Edit the Makefile from the &#8216;codesourcery&#8217; part of the example. Mine looks like this:<br />
<code><br />
####################################################################<br />
# Makefile                                                         #<br />
####################################################################</p>
<p>.SUFFIXES:				# ignore builtin rules<br />
.PHONY: all debug release clean</p>
<p>####################################################################<br />
# Definitions                                                      #<br />
####################################################################</p>
<p>DEVICE = EFM32G290F128<br />
PROJECTNAME = blinkG290</p>
<p>OBJ_DIR = build<br />
EXE_DIR = exe<br />
LST_DIR = lst</p>
<p>####################################################################<br />
# Definitions of toolchain.                                        #<br />
# You might need to do changes to match your system setup          #<br />
####################################################################</p>
<p># Change path to CodeSourcery tools according to your system configuration<br />
WINDOWSCS = CodeSourcery/Sourcery G++ Lite<br />
LINUXCS   = /Users/nemik/code/arm-cs-tools<br />
GCCVERSION = $(shell $(CC) -dumpversion)</p>
<p>ifeq ($(ComSpec),)<br />
  ifeq ($(COMSPEC),)<br />
    # Assume we are making on a linux platform<br />
    TOOLDIR = $(LINUXCS)<br />
    RM = rm -rf<br />
  else<br />
    TOOLDIR = $(PROGRAMFILES)/$(WINDOWSCS)<br />
    RM = "$(TOOLDIR)/bin/cs-rm" -rf<br />
  endif<br />
else<br />
  TOOLDIR = $(ProgramFiles)/$(WINDOWSCS)<br />
  RM = "$(TOOLDIR)/bin/cs-rm" -rf<br />
endif</p>
<p>CC      = "$(TOOLDIR)/bin/arm-none-eabi-gcc"<br />
LD      = "$(TOOLDIR)/bin/arm-none-eabi-ld"<br />
AR      = "$(TOOLDIR)/bin/arm-none-eabi-ar"<br />
OBJCOPY = "$(TOOLDIR)/bin/arm-none-eabi-objcopy"<br />
DUMP    = "$(TOOLDIR)/bin/arm-none-eabi-objdump" --disassemble</p>
<p>####################################################################<br />
# Flags                                                            #<br />
####################################################################</p>
<p># -MMD : Don't generate dependencies on system header files.<br />
# -MP  : Add phony targets, useful when a h-file is removed from a project.<br />
# -MF  : Specify a file to write the dependencies to.<br />
DEPFLAGS = -MMD -MP -MF $(@:.o=.d)<br />
# Add -Wa,-ahlms=$(LST_DIR)/$(@F:.o=.lst) to CFLAGS to produce assembly list files<br />
CFLAGS += -D$(DEVICE) -mcpu=cortex-m3 -mthumb -Wall  $(DEPFLAGS)<br />
ASMFLAGS += -Ttext 0x0<br />
LDFLAGS += -Xlinker -Map=$(LST_DIR)/$(PROJECTNAME).map -mcpu=cortex-m3 -mthumb -T../CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/efm32g.ld -L"$(TOOLDIR)/arm-none-eabi/lib/thumb2" \<br />
-L"$(TOOLDIR)/lib/gcc/arm-none-eabi/$(GCCVERSION)/thumb2"<br />
LIBS += -lc -lcs3 -lcs3unhosted</p>
<p>INCLUDEPATHS += \<br />
-I.. \<br />
-I../CMSIS/CM3/CoreSupport \<br />
-I../CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32 \<br />
-I../efm32lib/inc \<br />
-I../bsp \<br />
-I../drivers</p>
<p>####################################################################<br />
# Files                                                            #<br />
####################################################################</p>
<p>C_SRC +=  \<br />
../CMSIS/CM3/CoreSupport/core_cm3.c \<br />
../CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/system_efm32.c \<br />
../bsp/dvk.c \<br />
../bsp/dvk_boardcontrol.c \<br />
../bsp/dvk_ebi.c \<br />
../bsp/dvk_spi.c \<br />
../efm32lib/src/efm32_assert.c \<br />
../efm32lib/src/efm32_cmu.c \<br />
../efm32lib/src/efm32_gpio.c \<br />
../efm32lib/src/efm32_emu.c \<br />
../efm32lib/src/efm32_ebi.c \<br />
../efm32lib/src/efm32_system.c \<br />
../efm32lib/src/efm32_usart.c \<br />
blink.c</p>
<p>S_SRC +=  \<br />
../CMSIS/CM3/DeviceSupport/EnergyMicro/EFM32/startup/cs3/startup_efm32.s</p>
<p>####################################################################<br />
# Rules                                                            #<br />
####################################################################</p>
<p>C_FILES = $(notdir $(C_SRC) )<br />
S_FILES = $(notdir $(S_SRC) )<br />
#make list of source paths, sort also removes duplicates<br />
C_PATHS = $(sort $(dir $(C_SRC) ) )<br />
S_PATHS = $(sort $(dir $(S_SRC) ) )</p>
<p>C_OBJS = $(addprefix $(OBJ_DIR)/, $(C_FILES:.c=.o))<br />
S_OBJS = $(addprefix $(OBJ_DIR)/, $(S_FILES:.s=.o))<br />
C_DEPS = $(addprefix $(OBJ_DIR)/, $(C_FILES:.c=.d))</p>
<p>vpath %.c $(C_PATHS)<br />
vpath %.s $(S_PATHS)</p>
<p># Default build is debug build<br />
all:      debug</p>
<p>debug:    CFLAGS += -DDEBUG -g3 -O0<br />
debug:    $(OBJ_DIR) $(LST_DIR) $(EXE_DIR) $(EXE_DIR)/$(PROJECTNAME).bin</p>
<p>release:  CFLAGS += -DNDEBUG -O3<br />
release:  $(OBJ_DIR) $(LST_DIR) $(EXE_DIR) $(EXE_DIR)/$(PROJECTNAME).bin</p>
<p># Create directories<br />
$(OBJ_DIR):<br />
	mkdir $(OBJ_DIR)<br />
	@echo "Created build directory."</p>
<p>$(EXE_DIR):<br />
	mkdir $(EXE_DIR)<br />
	@echo "Created executable directory."</p>
<p>$(LST_DIR):<br />
	mkdir $(LST_DIR)<br />
	@echo "Created list directory."</p>
<p># Create objects from C SRC files<br />
$(OBJ_DIR)/%.o: %.c<br />
	@echo "Building file: $<"<br />
	$(CC) $(CFLAGS) $(INCLUDEPATHS) -c -o $@ $<</p>
<p># Assemble .s files<br />
$(OBJ_DIR)/%.o: %.s<br />
	@echo "Assembling $<"<br />
	$(CC) $(ASMFLAGS) $(INCLUDEPATHS) -c -o $@ $<</p>
<p># Link<br />
$(EXE_DIR)/$(PROJECTNAME).out: $(C_OBJS) $(S_OBJS)<br />
	@echo "Linking target: $@"<br />
	$(CC) $(LDFLAGS) $(C_OBJS) $(S_OBJS) $(LIBS) -o $(EXE_DIR)/$(PROJECTNAME).out</p>
<p># Create binary file<br />
$(EXE_DIR)/$(PROJECTNAME).bin: $(EXE_DIR)/$(PROJECTNAME).out<br />
	@echo "Creating binary file"<br />
	$(OBJCOPY) -O binary $(EXE_DIR)/$(PROJECTNAME).out $(EXE_DIR)/$(PROJECTNAME).bin<br />
# Uncomment next line to produce assembly listing of entire program<br />
#	$(DUMP) $(EXE_DIR)/$(PROJECTNAME).out>$(EXE_DIR)/$(PROJECTNAME).lst</p>
<p>clean:<br />
	$(RM) $(OBJ_DIR) $(LST_DIR) $(EXE_DIR)</p>
<p># include auto-generated dependency files (explicit rules)<br />
ifneq (clean,$(findstring clean, $(MAKECMDGOALS)))<br />
-include $(C_DEPS)<br />
endif<br />
</code></p>
<p>5. Run the `make` command</p>
<p>6. You should have a &#8216;blinkG290.bin&#8217; in the &#8216;exe&#8217; directory. Seems a bit nuts that my bin is 14kb though&#8230;seems quite high for a blinking program; could that be CodeSourcery&#8217;s libcs3 adding so much?</p>
<p>7. Now you can use the energyAware Commander Windows program to load the firmware onto the board :/. I was not able to get openOCD working with the on-board JLink module and SWD. I&#8217;m now in the process of trying to get my BusPirate board to act as a JTAG interface for using the 20-pin adapter of the EFM32 Development Kit and hoping it does JTAG&#8230;<br />
If not, one could also write a Python script with some XMODEM-CRC library to try to upload code to the built-in bootloader on the EFM32 chips using some FTDI USB-serial cable with something like the DST pin being used to pulse RESET and some other un-used serial pin to hold down DBG_SWCLK. But even then some way to debug is needed&#8230;really hoping JTAG can somehow work.</p>
<p>Has anyone tried to do something similar on Linux or OS X without the official Segger JLink software? They don&#8217;t produce OS X binaries and it&#8217;s closed source. Or has anyone gotten an EFM32 DK with its built-in JLink debugger to work with openOCD? Any suggestions would be awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nemik.net/2011/06/building-energy-micro-efm32-binaries-from-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OpenMoko and Wifi Ad-Hoc mode</title>
		<link>http://blog.nemik.net/2009/01/openmoko-and-wifi-ad-hoc-mode/</link>
		<comments>http://blog.nemik.net/2009/01/openmoko-and-wifi-ad-hoc-mode/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 04:47:32 +0000</pubDate>
		<dc:creator>nemik</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wifi openmoko dhcp]]></category>

		<guid isPermaLink="false">http://blog.nemik.net/?p=59</guid>
		<description><![CDATA[So i decided to give making-openmoko-a-wifi-AP thing another go. The USB wifi card I bought (ChiefMax RaLink RT73) needs some special cross-compiled drivers to put the wifi in master mode in order to act as an AP. So i gave up that route and tried making it an ad-hoc peer-to-peer access point. This (kinda) worked! [...]]]></description>
			<content:encoded><![CDATA[<p>So i decided to give making-openmoko-a-wifi-AP thing another go.</p>
<p>The USB wifi card I bought (ChiefMax RaLink RT73) needs some special cross-compiled drivers to put the wifi in master mode in order to act as an AP. So i gave up that route and tried making it an ad-hoc peer-to-peer access point.</p>
<p>This (kinda) worked! but only connecting with another Linux computer and even then, NetworkManager&#8217;s DHCP screwed up the subnet mask and that needed to be set manually.</p>
<p>Trying the same in Mac OS X and Windows XP was a colossal failure. Mac OS X refuses to even accept a DHCP offer from the openmoko (openmoko is using busybox&#8217;s udhcpd) and basically same for Windows: it gives itself some crazy nonsense IP.</p>
<p>So best option is still to get some magic USB wifi card that can be set to master mode from the openmoko using the drivers already in the kernel. I&#8217;m not really sure at this point which chipset would do that.</p>
<p>Either way, I think windows and mac have (very) flawed wifi ad-hoc implimentations. Linux&#8217;s is a little better but not by much. I guess it&#8217;s the &#8216;forgotten mode&#8217; of 802.11b/g.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nemik.net/2009/01/openmoko-and-wifi-ad-hoc-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send MMS&#8217;s to VBulletin Threads</title>
		<link>http://blog.nemik.net/2006/02/send-mmss-to-vbulletin-threads/</link>
		<comments>http://blog.nemik.net/2006/02/send-mmss-to-vbulletin-threads/#comments</comments>
		<pubDate>Wed, 01 Mar 2006 02:36:21 +0000</pubDate>
		<dc:creator>nemik</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.nemik.net/2006/02/28/send-mmss-to-vbulletin-threads/</guid>
		<description><![CDATA[I just recently put together a little script that will check an email address for incoming MMS (picture messages) and post them to a vBulletin thread. It is based off the work of a great script by Adrian Heydecker (http://wavestyle.ch) that h e made for the WordPress blog. I hacked it up for vBulletin. It [...]]]></description>
			<content:encoded><![CDATA[<p>I just recently put together a little script that will check an email address for incoming MMS (picture messages) and post them to a vBulletin thread. It is based off the work of a great script by Adrian Heydecker (<a title="http://wavestyle.ch" target="_blank" href="http://wavestyle.ch">http://wavestyle.ch</a>) that h<br />
e made for the WordPress blog.</p>
<p>I hacked it up for vBulletin. It is VERY primitive since I did not have enough time to make the MMS posts go through VB&#8217;s proper posting/replying procedure. So it does just a plain old mysql_query() that does and &#8220;INSERT&#8221; into the vb table that contains posts! Hah!</p>
<p>So please if someone knows the internal workings of VB (I don&#8217;t have time to look through the code) then please update this script to make it proper. <img src='http://blog.nemik.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
As a result, post-count and all that good stuff will not increase from MMS-posting; sorry!</p>
<p>Well I hope you enjoy anyway! The source can be found here: <a title="http://blog.nemik.net/wp-filez/mms-mail.phps" target="_blank" href="http://blog.nemik.net/wp-filez/mms-mail.phps">http://blog.nemik.net/wp-filez/mms-mail.phps</a></p>
<p>It is licensed under the GPL and I&#8217;m not responsible if it breaks your forum/site!</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nemik.net/2006/02/send-mmss-to-vbulletin-threads/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

