Commit graph

146 commits

Author SHA1 Message Date
Sean Cross
f8d8454fea Makefile: add -fno-stack-protector
Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-04-26 14:51:29 +08:00
Sean Cross
2a81feb153 README: Add -s to example
Without the -s, it simply runs in the background.  Add
-s to the example string.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-04-26 14:48:11 +08:00
Sean Cross
516c74096d fernly: fix gcc warnings
Several GCC warnings were getting generated on various compilers.  This
patch solves those warnings.

For various platforms, a uint32_t is not the same as an unsigned int. On
these platforms, printf("%x", (uint32_t)0) generates a warning.  Use the
<inttypes.h> formats (i.e. PRIx32) as formatters to silence these warnings.

There was also a security warning picked up by certain compilers when
calling printf(msg) in fernly-usb-loader.  This has been fixed.

Finally, lcd.c was refactored to fold the unused lcd_dat_slot() function
into the lcd_cmd_slot() function as a brand-new unified lcd_slot().

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-04-07 18:17:26 +08:00
Sean Cross
deced0717a Revert "Silenced GCC warnings"
This reverts commit 11ac2200ff.
2015-04-07 18:17:26 +08:00
Sean Cross
2df4be2da3 Merge pull request #24 from pfalcon/gfh-comments
fernly-usb-loader: Add comments about GFH file headers.
2015-04-07 17:51:37 +08:00
Sean Cross
ed30df482f Merge pull request #23 from pfalcon/scriptic-psram-typo
enable-psram.S: Fix typo in comment.
2015-04-07 17:51:07 +08:00
Sean Cross
49c0de1b02 Merge pull request #22 from pfalcon/readme-bootrom
README: Add Boot ROM to memory map.
2015-04-07 17:50:47 +08:00
Sean Cross
176f914b51 Merge pull request #19 from pfalcon/keypad-uart-exit
cmd-keypad: Exit also on key press on serial/USB connection.
2015-04-07 17:49:01 +08:00
Sean Cross
7402d86909 Merge pull request #20 from pfalcon/hex-abs-addr
cmd-hex: Dump absolute memory address.

This code has been copied-and-pasted across multiple projects, hence the split between
hex_offset() and hex().  This is a fine patch for this project.
2015-04-07 17:04:23 +08:00
Paul Sokolovsky
77e6ce9036 fernly-usb-loader: Add comments about GFH file headers. 2015-04-05 15:24:20 +03:00
Paul Sokolovsky
0c2c269242 enable-psram.S: Fix typo in comment. 2015-04-05 15:22:59 +03:00
Paul Sokolovsky
422f7f2bfb README: Add Boot ROM to memory map. 2015-04-05 15:17:27 +03:00
Paul Sokolovsky
69ad4d5eca cmd-hex: Dump absolute memory address.
Seeing zeros is quite confusing - you never know if you mistypes something
(there's not even a number format error reporting), or something else.
2015-04-02 22:12:44 +03:00
Paul Sokolovsky
bacfe8b822 cmd-keypad: Exit also on key press on serial/USB connection.
"keypad" command so far assumes rather adhoc keyboard map, and effectively
locks up otherwise. Allow to break out of it from host connection.
2015-04-02 13:35:34 +03:00
Sean Cross
a02ae82f67 Merge branch 'pfalcon-loader-wait' 2015-04-02 12:39:49 +08:00
Paul Sokolovsky
6020a9248a fernly-usb-loader.c: Add -w option, wait for serial port to appear.
Many MTK devices have bootloader connection available only for few seconds
after power-up. To not try to synchronize all of device connection over USB/
power-on and fernly-usb-loader start up, the latter can be run in this "wait"
mode, and a device connected and bootloader start at leisure.
2015-04-02 12:39:34 +08:00
Sean Cross
005e2d67d5 Merge branch 'master' of github.com:xobs/fernly 2015-04-02 12:34:21 +08:00
Sean Cross
41511b793d LICENSE: Add BSD 2-clause license
Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-04-02 12:33:42 +08:00
Sean Cross
7323c280ce fernly: Remove GPL-2 files, move to libgcc
We used to use source files taken from U-Boot to allow for division and
modular arithmetic.  With the move to a BSD license, this is no longer
acceptible.

As a workaround, use a libgcc taken from a standard gcc distribution.
Add the .a file, which has not been modified in any way.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-04-02 12:30:28 +08:00
Sean Cross
9e9bab1ff2 Merge pull request #16 from robertfoss/patch_1
Silenced GCC warnings
2015-03-18 17:15:59 +08:00
Sean Cross
ee08d8395a Merge pull request #15 from notthetup/patch-1
Changing baudrate to 115200
2015-03-18 17:13:55 +08:00
Robert Foss
11ac2200ff Silenced GCC warnings 2015-03-16 11:32:11 +01:00
Chinmay Pendharkar
0a1b9e3cd9 Changing baudrate to 115200
Changing baudrate to `B115200` which is defined in sys/temios.h on OSX.
2015-03-14 13:48:20 +08:00
Sean Cross
38011a7bdc spin: Remove not-very-relevant test script
This script was used early on to run Fernly on very customized hardware.
Remove it, as it's not relevant anymore.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-03-11 15:14:11 +08:00
Sean Cross
7d07f8a2f0 serial: Formatting cleanup of old cruft
Remove unreachable code paths and awkward code comments.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-03-11 15:03:24 +08:00
Sean Cross
1dc8e8c573 serial: Limit USB fifo to 1 byte
There is some racy condition where multiple bytes can cause a deadlock.
Until this is figured out, limit the FIFO to 1 byte.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-03-11 15:00:26 +08:00
Sean Cross
8a4f98b5b1 usb-loader: Explain a little more about magic calls
These calls enter into the MT6260 ROM.  Explain a bit more about where they
come from and what their function prototypes are.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-19 18:54:34 +08:00
Sean Cross
91d05709fc Makefile: make 'test' and 'shell' depend on 'all'
To ensure everything is rebuilt, have the 'test' and 'shell' targets
depend on the 'all' target.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 16:04:49 +08:00
Sean Cross
16ffca7170 Makefile: Add 'make shell' target
The 'make shell' target loads fernly onto the board, then opens an
interactive shell with it.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 16:03:50 +08:00
Sean Cross
d4283bc9ce fernly-usb-loader: Add 'shell' argument
To interactively communicate with the fernly loader, pass '-s' to the
fernly-usb-loader program.  Otherwise it will wait for the shell to
start and then exit.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 16:02:48 +08:00
Sean Cross
9759e98747 serial: Refactor slightly to improve throughput
It's unclear whether this refactor improves things at all, but it's
still limited to 32-byte buffers.  Still, it results in less code,
which seems like a good thing.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 15:50:28 +08:00
Sean Cross
977ccff309 bionic: Correct \r at the end of puts()
Since puts() calls serial_putc() directly, it needs to supply its own
\r before \n.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 13:03:08 +08:00
Sean Cross
f7207812b4 set-plls: Make script more robust
The set-plls script was running too quickly, and could sometimes
finish before the PLLs were stable.  This patch fixes this problem,
in addition to making it clearer what the various settings do.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 13:00:47 +08:00
Sean Cross
ef9d60df5c emi: Make dqs/dqy values global (for debug)
Make the dqs/dqy values available for printing in other functions, so
we can determine what values were chosen at startup.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 12:59:40 +08:00
Sean Cross
f15c7fb929 enable-psram: Make initialization more robust
PSRAM was failing on some newer parts.  This change writes additional
values to the EMI controller early on that seems to fix the problems.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 12:58:27 +08:00
Sean Cross
c293f0e73f scriptic: Clean up debug output a bit
We can save a bit of space by not printing out command names twice.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 12:05:29 +08:00
Sean Cross
014b62ab26 bionic: Have putchar() put \r if \n is printed
Since putchar() is only called by printf() (as opposed to the lower-
level serial_putc()), we can have it nicely format the output by
adding \r when \n is printed.

To get the old behavior back, call serial_putc() directly.

This fixes gcc's optimization when calling:

    printf("\n")

As this will get silently turned into a call to putchar('\n')

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 11:31:53 +08:00
Sean Cross
1023337c61 serial: Use the USB FIFO
We now use 32 bytes of the USB FIFO to increase performance with bulk
operations.

There may still be issues lurking, and 64-bytes causes issues, but so
far I've been able to read the entire SPI in 30 seconds, and it validates.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 01:08:40 +08:00
Sean Cross
7ca50ab413 cmd-spi: Remove dummy read from flashrom
The dummy read was due to a bug in the host-side flashrom code.  It was
sending the NULL byte from the string.  The host code has been fixed, so
the dummy read should be removed.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 00:17:50 +08:00
Sean Cross
7b8a203f48 main: Convert serial_putc() to serial_puts()
This fixes printing '\r' when '\n' is printed.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:32:42 +08:00
Sean Cross
7321bd91ad vsprintf: Emit '\r' when printing '\n'
Since putc() doesn't automatically print '\r' when '\n' is printed,
we must manually do this conversion ourselves.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:30:59 +08:00
Sean Cross
0bfdbb314f fernly-usb-loader: Get rid of call to 'screen'
Since we have an internal terminal of sorts, remove the call to 'screen'
when not running in monitor mode.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:30:03 +08:00
Sean Cross
9aad9797e6 README: Document flsahrom protocol
The flashrom protocol is binary, for speed.  Document this protocol.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:29:04 +08:00
Sean Cross
fb9c876148 cmd-spi: Add binary mode for flashrom
In order to improve reliability, add a binary mode for interacting
with the SPI chip.  This lets us hook up flashrom.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:28:29 +08:00
Sean Cross
7fd6d1d093 bionic: Emit \r in puts()
Since serial_putc() doesn't automatically add \r to \n, add it in puts().

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:14:14 +08:00
Sean Cross
70140aa665 serial: Fix serial driver
The serial driver was having issues reading data.  This commit makes
the serial driver more robust.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:05:03 +08:00
Sean Cross
1602ba550c serial: Fix USB data receive
Due to a typo, USB receive was unreliable.  This patch corrects a typo
that was causing USB receive to fail on certain devices.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-03 15:01:01 +08:00
Jacob Rosenthal
4f74885821 README: Add information on OS X serial driver
The default USB-CDC driver that ships with OS X does not recognize the
Fernvale platform.

Link to a repo maintianed by Jacob Rosenthal that works around the problem.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 17:49:50 +08:00
Robert Foss
1e9fd14f3e README: Add cross compilation instructions
To make cross-compilation easy, refer users to the setup_codesourcery
repo that is maintained by Robert Foss.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 17:46:20 +08:00
Robert Foss
a8bd97b5d0 fernly-usb-loader: Silence a few printf warnings
This silences some printf() warnings that appear due to varying sizes
of printf arguments.
2015-02-02 17:42:46 +08:00