I am currently trying to write startup code in assembly for an STM8 without any vendor libraries. More specifically, I am using an STM8S103f3p6. I am still inexperienced in assembly and with startup code, but I am confident to know what has to be done at the start of a µC. But apparently I don't know, HOW it is done.
For assembly, I am currently using the STM8-AS which is based on GNU AS. At the very start of my reset_handler, I want to set the stack pointer to the end of RAM 0x0003FF like shown in the datasheet (direct download). But the reference manual states that the stack pointer (SPH and SPL) can not be accessed by memory access instructions. But setting the SP in debug mode can't be correct, can it? I am unsure what to make of that

STM8 Assembly startup code: Access Core registers to initialize stack pointer
100 Views Asked by Alex At
1
There are 1 best solutions below
Related Questions in STARTUP
- get all startup processes in windows
- RPi running script at boot then stops
- Java move application to startup folder
- Detect Matlab startup from toolbox
- How to start with liferay
- bento start command fails with NoClassDefFoundError DNSCheckingTool
- Entity Framework Code First 30+ seconds StartUp Time
- How to load database at App Start up?
- Android CalendarView with no default date needed
- Insert data in collection at Meteor's startup
- BBB [debian] How to execute LSBInitscript AFTER loading device tree overlay?
- Error On MongoDB Start Up
- chkconfig not adding redis init script
- Change Stack Location for Cortex M3 in Startup.s file
- Running code without ssh in beaglebone black
Related Questions in STACK-POINTER
- vector, sfml and "the value of esp was not properly saved across the function call" error
- (x86) Is the value of ESP relative to EBP, or not?
- $sp register does not change at the beginning of the function
- How should I get gcc to realign the stack pointer to a 16-byte boundary on the way in to a function?
- Is this inline-asm approach for stack switching ok?
- Balancing the stack
- STM8 Assembly startup code: Access Core registers to initialize stack pointer
- I can't use RSP to reference the end of the stack
- Cortex M4 stacking and unstacking with a diferent stack pointer
- Clang ignores -mstack-alignment=XX flag
- Get the Stack Pointer in C on Mac OS X Lion
- push stack pointer in MIPS
- Why 'rbp' of a frame is not matching 'rsp' of previous frame?
- Why the stack pointer is special in the register file?
- Stack pointer set correctly but call not working
Related Questions in SDCC
- Simple C programs returns too many parameters error
- Installation of a specific version from svn repository
- Compiling string literals in ASM for SDCC/LCC
- Problems combining SDCC and ASM code compiling on the Intel 8051
- Why is this function called with no body before being declared, and what exactly is the '2' doing?
- STM8 Assembly startup code: Access Core registers to initialize stack pointer
- Makefile: no rule to make target (sdcc)
- SDCC compiler switch statement, what is ack: section for?
- How does C programming work with no headers?
- SDCC generates unnecessary division by zero
- Different appearance between SDCC and Keil with the same code in 8051
- How to create packed arrays of bit fields with SDCC?
- Want to scale int to int with integer math
- MCU 8051 IDE with SDCC stuck at compiling
- With SDCC, how to access word pointer from another file
Related Questions in STM8
- STM8 timer not ticking at the right time
- STM8SF103 Assembly - Load immediate value to ram register
- stm8 Read Out Protection (ROP) setting option byte in code
- stm8s003 timer1 channel2 capture doesn't work
- STM8 Assembly startup code: Access Core registers to initialize stack pointer
- Stm8l mcu RTC calibration problem using RTC_SmoothCalibConfig()
- How to correctly read data returned by MFRC522 via SPI using STM8S103F3?
- [C]unrecognized token "@address" on VScode
- How to get STM8 interrupts working properly
- SDCC generates unnecessary division by zero
- Not able to Debug STM8s001J3 with STVD and STVP using STLinkv2 Debugger
- STM8 UART polling receive is mangles
- UART issue for reading 2 bytes length
- Refering in code to section placed in RAM, cause linker error [Lc036]
- C typedef enum "impossible" value in debug mode
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
According to the data sheet table 9, the SP holds 0x03FF on reset. So you don't need to set it explicitly in this case. The programming manual says the same in chapter 3.2:
However, if you want to load a value into the SP, you can use only one of these instructions according to the programming manual (chapter 7.4 on
LDW):LDW SP, XLDW SP, YThe registers
XandYcan be loaded before with immediate values, for exampleLDW Y, #$03FF.The complete sequence with
Yis: