Fix error in AT91SAM SPI driver introduced in recent comment. Varioius improvements to README files and debug output
This commit is contained in:
parent
b40def3027
commit
516c3bb7c2
@ -13,6 +13,7 @@ Contents
|
||||
- NuttX EABI "buildroot" Toolchain
|
||||
- NuttX OABI "buildroot" Toolchain
|
||||
- NXFLAT Toolchain
|
||||
- AtmelStudio6.1
|
||||
- LEDs
|
||||
- SAM3U-EK-specific Configuration Options
|
||||
- Configurations
|
||||
@ -213,12 +214,32 @@ NXFLAT Toolchain
|
||||
8. Edit setenv.h, if necessary, so that the PATH variable includes
|
||||
the path to the newly builtNXFLAT binaries.
|
||||
|
||||
AtmelStudio6.1
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
You can use AtmelStudio6.1 to load and debug code.
|
||||
|
||||
- To load code:
|
||||
|
||||
Tools -> Device Programming
|
||||
|
||||
Configure the debugger and chip and you are in business.
|
||||
|
||||
- To Debug Code:
|
||||
|
||||
File -> Open -> Open Object File for Debugging
|
||||
|
||||
Select the project name, the full path to the NuttX object (called
|
||||
just nuttx with no extension), and chip. Take the time to resolve
|
||||
all of the source file linkages or else you will not have source
|
||||
level debug!
|
||||
|
||||
LEDs
|
||||
^^^^
|
||||
|
||||
The SAM3U-EK board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
|
||||
the board. Usage of these LEDs is defined in include/board.h and src/up_leds.c.
|
||||
They are encoded as follows:
|
||||
The SAM3U-EK board has four LEDs labeled LD1, LD2, LD3 and LD4 on the
|
||||
the board. Usage of these LEDs is defined in include/board.h and src/up_leds.c.
|
||||
They are encoded as follows:
|
||||
|
||||
SYMBOL Meaning LED0* LED1 LED2
|
||||
------------------- ----------------------- ------- ------- -------
|
||||
@ -405,6 +426,42 @@ Configurations
|
||||
2. Unless stated otherwise, all configurations generate console
|
||||
output of UART0 (J3).
|
||||
|
||||
3. Unless otherwise stated, the configurations are setup for
|
||||
Linux (or any other POSIX environment like Cygwin under Windows):
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
|
||||
|
||||
4. These configurations use the older, OABI, buildroot toolchain. But
|
||||
that is easily reconfigured:
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
||||
|
||||
If you want to use the Atmel GCC toolchain, here are the steps to
|
||||
do so:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Windows
|
||||
CONFIG_HOST_CYGWIN=y : Using Cygwin or other POSIX environment
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
This re-configuration should be done before making NuttX or else the
|
||||
subsequent 'make' will fail. If you have already attempted building
|
||||
NuttX then you will have to 1) 'make distclean' to remove the old
|
||||
configuration, 2) 'cd tools; ./configure.sh sam3u-ek/ksnh' to start
|
||||
with a fresh configuration, and 3) perform the configuration changes
|
||||
above.
|
||||
|
||||
Also, make sure that your PATH variable has the new path to your
|
||||
Atmel tools. Try 'which arm-none-eabi-gcc' to make sure that you
|
||||
are selecting the right tool. setenv.sh is available for you to
|
||||
use to set or PATH variable. The path in the that file may not,
|
||||
however, be correct for your installation.
|
||||
|
||||
Configuration sub-directories
|
||||
-----------------------------
|
||||
|
||||
@ -424,30 +481,7 @@ Configuration sub-directories
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration is setup for Linux (or any other POSIX environment
|
||||
like Cygwin under Windows):
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
|
||||
|
||||
2. This configuration uses the older, OABI, buildroot toolchain. But
|
||||
that is easily reconfigured:
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
||||
|
||||
If you want to use the Atmel GCC toolchain, here are the steps to
|
||||
do so:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Windows
|
||||
CONFIG_HOST_CYGWIN=y : Using Cygwin or other POSIX environment
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
3. At the end of the build, there will be several files in the top-level
|
||||
1. At the end of the build, there will be several files in the top-level
|
||||
NuttX build directory:
|
||||
|
||||
PASS1:
|
||||
@ -463,7 +497,7 @@ Configuration sub-directories
|
||||
The J-Link programmer will except files in .hex, .mot, .srec, and .bin
|
||||
formats.
|
||||
|
||||
4. Combining .hex files. If you plan to use the .hex files with your
|
||||
2. Combining .hex files. If you plan to use the .hex files with your
|
||||
debugger or FLASH utility, then you may need to combine the two hex
|
||||
files into a single .hex file. Here is how you can do that.
|
||||
|
||||
@ -513,30 +547,7 @@ Configuration sub-directories
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration is setup for Linux (or any other POSIX environment
|
||||
like Cygwin under Windows):
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
|
||||
|
||||
2. This configuration uses the older, OABI, buildroot toolchain. But
|
||||
that is easily reconfigured:
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
||||
|
||||
If you want to use the Atmel GCC toolchain, here are the steps to
|
||||
do so:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Windows
|
||||
CONFIG_HOST_CYGWIN=y : Using Cygwin or other POSIX environment
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
3. NSH built-in applications are supported. However, there are
|
||||
1. NSH built-in applications are supported. However, there are
|
||||
no built-in applications built with the default configuration.
|
||||
|
||||
Binary Formats:
|
||||
@ -545,7 +556,7 @@ Configuration sub-directories
|
||||
Applicaton Configuration:
|
||||
CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
|
||||
|
||||
4. This configuration has been used for verifying the touchscreen on
|
||||
2. This configuration has been used for verifying the touchscreen on
|
||||
on the SAM3U-EK LCD. With these modifications, you can include the
|
||||
touchscreen test program at apps/examples/touchscreen as an NSH built-in
|
||||
application. You can enable the touchscreen and test by modifying the
|
||||
@ -591,58 +602,7 @@ Configuration sub-directories
|
||||
Configures to use examples/nx using the HX834x LCD hardware on
|
||||
the SAM3U-EK development board.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration is setup for Linux (or any other POSIX environment
|
||||
like Cygwin under Windows):
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
|
||||
|
||||
2. This configuration uses the older, OABI, buildroot toolchain. But
|
||||
that is easily reconfigured:
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
||||
|
||||
If you want to use the Atmel GCC toolchain, here are the steps to
|
||||
do so:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Windows
|
||||
CONFIG_HOST_CYGWIN=y : Using Cygwin or other POSIX environment
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
ostest:
|
||||
This configuration directory, performs a simple OS test using
|
||||
examples/ostest. By default, this project assumes that you are
|
||||
using the DFU bootloader.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration is setup for Linux (or any other POSIX environment
|
||||
like Cygwin under Windows):
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_LINUX=y : Linux or other POSIX environment
|
||||
|
||||
2. This configuration uses the older, OABI, buildroot toolchain. But
|
||||
that is easily reconfigured:
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain
|
||||
|
||||
If you want to use the Atmel GCC toolchain, here are the steps to
|
||||
do so:
|
||||
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Windows
|
||||
CONFIG_HOST_CYGWIN=y : Using Cygwin or other POSIX environment
|
||||
|
||||
System Type -> Toolchain:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
|
@ -59,8 +59,10 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static xcpt_t g_irqbutton1;
|
||||
static xcpt_t g_irqbutton2;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
@ -143,7 +143,7 @@
|
||||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# undef CONFIG_DEBUG_GRAPHICS
|
||||
# undef CONFIG_DEBUG_LED
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DEBUG_VERBOSE
|
||||
@ -159,9 +159,17 @@
|
||||
/* Debug ******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LCD_REGDEBUG
|
||||
# define regdbg(format, arg...) vdbg(format, ##arg)
|
||||
# define regdbg(format, arg...) vdbg(format, ##arg)
|
||||
#else
|
||||
# define regdbg(x...)
|
||||
# define regdbg(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
# define lcddbg(format, arg...) dbg(format, ##arg)
|
||||
# define lcdvdbg(format, arg...) vdbg(format, ##arg)
|
||||
#else
|
||||
# define lcddbg(x...)
|
||||
# define lcdvdbg(x...)
|
||||
#endif
|
||||
|
||||
/* Graphics Capbilities ***************************************************************/
|
||||
@ -305,7 +313,9 @@ struct sam_dev_s
|
||||
/* Low-level HX834x Register access */
|
||||
|
||||
static void sam_putreg(uint16_t reg, uint16_t data);
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
static uint16_t sam_getreg(uint16_t reg);
|
||||
#endif
|
||||
|
||||
/* Misc. LCD Helper Functions */
|
||||
|
||||
@ -316,10 +326,8 @@ static inline uint16_t sam_rdram(void);
|
||||
static void sam_lcdon(void);
|
||||
static void sam_lcdoff(void);
|
||||
|
||||
#ifdef CONFIG_DEBUG_GRAPHICS
|
||||
#if 0 /* CONFIG_DEBUG_LCD */
|
||||
static void sam_dumpreg(uint8_t startreg, uint8_t endreg);
|
||||
#else
|
||||
# define sam_dumpreg(startreg,endreg)
|
||||
#endif
|
||||
|
||||
/* LCD Data Transfer Methods */
|
||||
@ -442,6 +450,7 @@ static void sam_putreg(uint16_t reg, uint16_t data)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
static uint16_t sam_getreg(uint16_t reg)
|
||||
{
|
||||
uint16_t data;
|
||||
@ -450,6 +459,7 @@ static uint16_t sam_getreg(uint16_t reg)
|
||||
regdbg("base: %08x RS: %04x data: %04x\n", LCD_BASE, LCD_BASE + HX843X_LCD_RS, data);
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: sam_setcursor
|
||||
@ -533,7 +543,7 @@ static void sam_lcdon(void)
|
||||
{
|
||||
/* Display ON Setting */
|
||||
|
||||
gvdbg("ON\n");
|
||||
lcdvdbg("ON\n");
|
||||
sam_putreg(HX8347_R90H, 0x7f); /* SAP=0111 1111 */
|
||||
sam_putreg(HX8347_R26H, 0x04); /* GON=0 DTE=0 D=01 */
|
||||
up_mdelay(100);
|
||||
@ -553,7 +563,7 @@ static void sam_lcdon(void)
|
||||
|
||||
static void sam_lcdoff(void)
|
||||
{
|
||||
gvdbg("OFF\n");
|
||||
lcdvdbg("OFF\n");
|
||||
sam_putreg(HX8347_R90H, 0x00); /* SAP=0000 0000 */
|
||||
sam_putreg(HX8347_R26H, 0x00); /* GON=0 DTE=0 D=00 */
|
||||
}
|
||||
@ -566,7 +576,7 @@ static void sam_lcdoff(void)
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_GRAPHICS
|
||||
#if 0 /* CONFIG_DEBUG_LCD */
|
||||
static void sam_dumpreg(uint8_t startreg, uint8_t endreg)
|
||||
{
|
||||
uint16_t value;
|
||||
@ -575,7 +585,7 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg)
|
||||
for (addr = startreg; addr <= endreg; addr++)
|
||||
{
|
||||
value = sam_getreg(addr);
|
||||
gdbg(" %02x: %04x\n", addr, value);
|
||||
lcddbg(" %02x: %04x\n", addr, value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -602,7 +612,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
|
||||
|
||||
/* Buffer must be provided and aligned to a 16-bit address boundary */
|
||||
|
||||
gvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
|
||||
lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
|
||||
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
|
||||
|
||||
#ifdef CONFIG_LCD_PORTRAIT
|
||||
@ -668,7 +678,7 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
|
||||
|
||||
/* Buffer must be provided and aligned to a 16-bit address boundary */
|
||||
|
||||
gvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
|
||||
lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
|
||||
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
|
||||
|
||||
#ifdef CONFIG_LCD_PORTRAIT
|
||||
@ -719,8 +729,8 @@ static int sam_getvideoinfo(FAR struct lcd_dev_s *dev,
|
||||
FAR struct fb_videoinfo_s *vinfo)
|
||||
{
|
||||
DEBUGASSERT(dev && vinfo);
|
||||
gvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
|
||||
g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
|
||||
lcdvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n",
|
||||
g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes);
|
||||
memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
|
||||
return OK;
|
||||
}
|
||||
@ -737,7 +747,7 @@ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
|
||||
FAR struct lcd_planeinfo_s *pinfo)
|
||||
{
|
||||
DEBUGASSERT(dev && pinfo && planeno == 0);
|
||||
gvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
|
||||
lcdvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
|
||||
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
|
||||
return OK;
|
||||
}
|
||||
@ -755,7 +765,7 @@ static int sam_getpower(struct lcd_dev_s *dev)
|
||||
{
|
||||
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
|
||||
DEBUGASSERT(dev);
|
||||
gvdbg("power: %d\n", priv->power);
|
||||
lcdvdbg("power: %d\n", priv->power);
|
||||
return priv->power;
|
||||
}
|
||||
|
||||
@ -779,7 +789,7 @@ static int sam_setpower(struct lcd_dev_s *dev, int power)
|
||||
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
|
||||
unsigned int i;
|
||||
|
||||
gvdbg("power: %d\n", power);
|
||||
lcdvdbg("power: %d\n", power);
|
||||
DEBUGASSERT(power <= CONFIG_LCD_MAXPOWER);
|
||||
|
||||
/* Switch off backlight */
|
||||
@ -823,7 +833,7 @@ static int sam_setpower(struct lcd_dev_s *dev, int power)
|
||||
|
||||
static int sam_getcontrast(struct lcd_dev_s *dev)
|
||||
{
|
||||
gvdbg("Not implemented\n");
|
||||
lcdvdbg("Not implemented\n");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
@ -837,7 +847,7 @@ static int sam_getcontrast(struct lcd_dev_s *dev)
|
||||
|
||||
static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
|
||||
{
|
||||
gvdbg("contrast: %d\n", contrast);
|
||||
lcdvdbg("contrast: %d\n", contrast);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
@ -857,13 +867,13 @@ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
|
||||
|
||||
int up_lcdinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_GRAPHICS
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
uint16_t hxregval;
|
||||
#endif
|
||||
uint32_t regval;
|
||||
unsigned int i;
|
||||
|
||||
gvdbg("Initializing\n");
|
||||
lcdvdbg("Initializing\n");
|
||||
|
||||
/* Enable LCD EXTCS2 pins */
|
||||
|
||||
@ -930,12 +940,12 @@ int up_lcdinitialize(void)
|
||||
|
||||
/* Check HX8347 Chip ID */
|
||||
|
||||
#ifdef CONFIG_DEBUG_GRAPHICS
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
hxregval = sam_getreg(HX8347_R67H);
|
||||
gvdbg("Chip ID: %04x\n", hxregval);
|
||||
lcdvdbg("Chip ID: %04x\n", hxregval);
|
||||
if (hxregval != HX8347_CHIPID)
|
||||
{
|
||||
gdbg("Bad chip ID: %04x Expected: %04x\n", hxregval, HX8347_CHIPID);
|
||||
lcddbg("Bad chip ID: %04x Expected: %04x\n", hxregval, HX8347_CHIPID);
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
@ -1038,7 +1048,7 @@ int up_lcdinitialize(void)
|
||||
|
||||
FAR struct lcd_dev_s *up_lcdgetdev(int lcddev)
|
||||
{
|
||||
gvdbg("lcddev: %d\n", lcddev);
|
||||
lcdvdbg("lcddev: %d\n", lcddev);
|
||||
return lcddev == 0 ? &g_lcddev_s.dev : NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user