private void doFirmwareUpload() throws FirmwareFlashException {
		int exitCode;
		try {
			ProcessBuilder pb = new ProcessBuilder();
			// this would be where you'd switch based on OS to run the appropriate
			// firmware upload command.
			Vector<String> commandLine = new Vector<String>();
			if (os == OS.WINDOWS) {
//				pb.directory(new File("windows_flash"));
				commandLine.add("windows_flash/avrdude.exe");
				commandLine.add("-Cwindows_flash/avrdude.conf");
			}
			if (os == OS.MAC) {
				commandLine.add("./mac_flash/avrdude");
				commandLine.add("-Cmac_flash/avrdude.conf");
			}
			if (os == OS.LINUX) {
				pb.directory(new File(System.getProperty("user.dir")));
				commandLine.add("avrdude");
			}
			commandLine.add("-Ueeprom:w:firmware/blank_eeprom.hex:i");
			commandLine.add("-Uflash:w:firmware/firmware.hex:i");
			commandLine.add("-q");
			commandLine.add("-patmega328p");
			commandLine.add("-cstk500v1");
			commandLine.add("-P" + window.getSelectedCOMPort());
			commandLine.add("-b57600");
			commandLine.add("-D");
			pb.command(commandLine);

			Process p = pb.start();

			StreamLogPump errorPump = new StreamLogPump(p.getErrorStream(), "error");
			StreamLogPump outputPump = new StreamLogPump(p.getInputStream(), "altimeter");
			errorPump.start();
			outputPump.start();
	
			exitCode = p.waitFor();
		} catch (Exception e) {
			e.printStackTrace();
			throw new FirmwareFlashException();
		}
		if (exitCode != 0) {
			log("avrdude failed with exit code: " + exitCode, "error");
			throw new FirmwareFlashException();
		}
	}