Name
HAL Port — Implementation Details
Overview
This documentation explains how the eCos HAL specification has been mapped onto the DNP/5280 hardware, and should be read in conjunction with that specification. The DNP/5280 platform HAL package complements the M68K architectural HAL, the MCFxxxx variant HAL, and the MCF5282 processor HAL. It provides functionality which is specific to the target board.
Startup
Following a hard or soft reset the HAL will initialize those devices
for which there are active device drivers. There is an exception for
RAM startup applications which depend on a ROM monitor for certain
services: the UARTs and the ethernet device will not be reinitialized
because they may be in use by RedBoot for communication with the host.
Full details of this initialization can be found in the function
hal_m68k_dnp5280_init
in
platform.c
.
For a ROM startup the HAL will perform additional initialization,
setting up the external DRAM and chip selects. Full details can be
found in the exported header cyg/hal/plf.inc
.
Linker Scripts and Memory Maps
The platform HAL package provides the memory layout information needed to generate the linker script. The key memory locations are as follows:
- External SDRAM
- This is mapped to location 0x00000000. Most of the first kilobyte is used for hardware exception vectors. The eCos virtual vectors are also placed here, allowing RAM-based applications to use services provided by the ROM monitor. For ROM startup all remaining SDRAM is available. For RAM and DBUG startup available SDRAM starts at location 0x00010000, with the bottom 64K reserved for use by either the RedBoot or dBUG ROM monitors.
- Internal RAM
- The 64K of internal RAM are normally mapped at location 0x20000000. Neither eCos nor RedBoot use the internal RAM so all of it is available to application code.
- On-chip Peripherals
These are accessible at location 0x40000000 onwards, as per the defined symbol
HAL_MCF5282_ISPBAR
.Note On some other ColdFire processors the equivalent register is known as
%mbar
. The symbolHAL_MCFxxxx_MBAR
is an alias forHAL_MCF5282_ISPBAR
, making it easier to share device drivers.- On-chip Flash
- When configured for a DNP/5282 the on-chip flash will be located at 0xF0000000. This flash is not used by either eCos or RedBoot so it is all available for use by application code.
- External Flash
- This is located at the top of memory, location 0xFF800000 onwards. In a typical setup the first two 64K flash blocks at location 0xFF800000 are used to hold RedBoot, and the block at location 0xFFFF0000 is used to hold flash management data and the RedBoot fconfig variables. The remaining blocks can be used by application code.
Clock Support
The platform HAL provides configuration options for the eCos system clock. This always uses the hardware timer PIT3, which should not be used directly by application code. The actual HAL macros for managing the clock are provided by the MCF5282 processor HAL. The specific numbers used are a characteristic of the platform because they depend on the processor speed. The gprof-based profiling code uses PIT2. Timers PIT0 and PIT1 are not used by eCos so application code is free to manipulate these as required.
Other Issues
The DNP/5280 platform HAL does not affect the implementation of other parts of the eCos HAL specification. The MCF5282 processor HAL, the MCFxxxx variant HAL, and the M68K architectural HAL documentation should be consulted for further details.
Other Functionality
The platform HAL package provides a flash driver for the off-chip
AMD AM29LV640 flash chip. This driver is inactive by default, and
only becomes active if the configuration includes the generic flash
support CYGPKG_IO_FLASH
.
The platform HAL provides some additional functions for manipulating the LEDs and dipswitch on the DNP/EVA2_SV6 carrier board:
-
void hal_dnp5280_led_set(which, what)
-
This can be used to switch one of the LEDs on or off. The
which
argument specifies the LED and should be a number between 0 and 7. Thewhat
argument should be non-zero to switch the LED on, zero to switch it off. This function must not be called if the processor's QA and QB pins are not actually connected to the LEDs. -
int hal_dnp5280_dipswitch_read(which)
-
This allows application code to query the state of one of the dip
switches. The
which
argument should be a number between 1 and 8. -
int hal_dnp5280_dipswitch_read_all(void)
- This allows application code to query the state of all the dip switches in one go. The result is an 8-bit number with bit 0 corresponding to dipswitch 1.
2024-12-10 | eCosPro Non-Commercial Public License |