Gdb support, Setjmp and longjmp support, Stack sizes – Comtrol eCos User Manual

Page 285: Address translation

Advertising
background image

Chapter 9. HAL Interfaces

HAL_BREAKINST

contains the breakpoint instruction code as an integer value.

HAL_BREAKINST_SIZE

is the size of

that breakpoint instruction in bytes. Together these may be used to place a breakpoint in any code.

GDB support

HAL_THREAD_GET_SAVED_REGISTERS( sp, regs )

HAL_GET_GDB_REGISTERS( regval, regs )

HAL_SET_GDB_REGISTERS( regs, regval )

These macros provide support for interfacing GDB to the HAL.

HAL_THREAD_GET_SAVED_REGISTERS()

extracts a pointer to a HAL_SavedRegisters structure from a stack

pointer value. The stack pointer passed in should be the value saved by the thread context macros. The macro will
assign a pointer to the HAL_SavedRegisters structure to the variable passed as the second argument.

HAL_GET_GDB_REGISTERS()

translates a register state as saved by the HAL and into a register dump in the format

expected by GDB. It takes a pointer to a HAL_SavedRegisters structure in the

regs

argument and a pointer to the

memory to contain the GDB register dump in the

regval

argument.

HAL_SET_GDB_REGISTERS()

translates a GDB format register dump into a the format expected by the HAL. It

takes a pointer to the memory containing the GDB register dump in the

regval

argument and a pointer to a

HAL_SavedRegisters structure in the

regs

argument.

Setjmp and longjmp support

CYGARC_JMP_BUF_SIZE

hal_jmp_buf[CYGARC_JMP_BUF_SIZE]

hal_setjmp( hal_jmp_buf env )

hal_longjmp( hal_jmp_buf env, int val )

These functions provide support for the C

setjmp()

and

longjmp()

functions. Refer to the C library for further

information.

Stack Sizes

CYGNUM_HAL_STACK_SIZE_MINIMUM

CYGNUM_HAL_STACK_SIZE_TYPICAL

The values of these macros define the minimum and typical sizes of thread stacks.

CYGNUM_HAL_STACK_SIZE_MINIMUM

defines the minimum size of a thread stack. This is enough for the thread

to function correctly within eCos and allows it to take interrupts and context switches. There should also be
enough space for a simple thread entry function to execute and call basic kernel operations on objects like mu-
texes and semaphores. However there will not be enough room for much more than this. When creating stacks
for their own threads, applications should determine the stack usage needed for application purposes and then add

CYGNUM_HAL_STACK_SIZE_MINIMUM

.

181

Advertising