Hi guys,
I'm wishing to move the location of the stack but how is this possible? In the startup.s I have
EXPORT __initial_sp Stack_Size EQU 0x00000200 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp
However there's no option for the location and nothing specific for the stack appears to show up in the generate scatter file.
I'm a little lost and would appreciate any help.
Many thanks
Deconvoluting a little of what I said, here's my ASM code:
; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD WAKEUP_IRQHandler ; 12 wakeup sources for all the DCD WAKEUP_IRQHandler ; I/O pins starting from PIO0 (0:11) DCD WAKEUP_IRQHandler ; all 40 are routed to the same ISR DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD WAKEUP_IRQHandler DCD I2C_IRQHandler ; I2C DCD TIMER16_0_IRQHandler ; 16-bit Timer0 DCD TIMER16_1_IRQHandler ; 16-bit Timer1 DCD TIMER32_0_IRQHandler ; 32-bit Timer0 DCD TIMER32_1_IRQHandler ; 32-bit Timer1 DCD SSP_IRQHandler ; SSP DCD UART0_IRQHandler ; UART0 DCD UART1_IRQHandler ; UART1 DCD COMP_IRQHandler ; Comparator DCD ADC_IRQHandler ; A/D Converter DCD WDT_IRQHandler ; Watchdog timer DCD BOD_IRQHandler ; Brown Out Detect DCD FMC_IRQHandler ; IP2111 Flash Memory Controller DCD PIOINT0_IRQHandler ; PIO INT0 DCD PIOINT1_IRQHandler ; PIO INT1 DCD PIOINT2_IRQHandler ; PIO INT2 DCD PMU_IRQHandler ; PMU/Wakeup DCD DMA_IRQHandler ; DMA DCD RTC_IRQHandler ; RTC AREA VECTORS, NOINIT, DATA, READWRITE ; Reserve space for vector table in RAM SPACE 0xBC AREA FIRMWARE, NOINIT, DATA, READWRITE ; Reserve space for Firmware Flashing in RAM EXPORT __UpdateBuffer __UpdateBuffer SPACE 0x80 ; Reserve 128B of space as a firmware update buffer ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> EXPORT __initial_sp Stack_Size EQU 0x00000147 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp END
As it stands, the start of the stack is always the same as the Stack_Size, in this case 0x147. I instead want it at 0x1FF with a size of 0x147. As you can see I'm attempting to reserve space, however it's not working so well.
Have you considered a scatter file for specifying where you want to locate different AREAs?
Yes, I will ultimately do this if I have no choice but I was hoping to keep within the default uVision layout - this is so that those who come after me will have less of a learning curve and the software is easier to maintain.
It feels as though I should be able to reserve a block of space within an area without having to resort to scatter files.
One thing I can say form all of this is that the scatter-file/memory allocation system in uVision could do with a rethink and overhaul. Ideally you want scatter file editing to be natively possible, as it seems, for me at least, I almost always end up having to implement my own.