Forum : ST7/STM8
Post Information | Post |
---|---|
September 7, 2011 - 9:15pm
|
I am working on bringing up a new graphics library on a STM8AF51A9 target using the Raisonance 9_26_2009 Compiler / Linker. I have since run into an issue where the library has large blocks of data (fonts etc...) that are larger than the 256 byte page. The resolution that the Linker manual states is: "The error message indicates which segment has the problem. Either do not specify the segment with the INPAGE directive, or move some of the variables in the segment into another segment, which can also be located using the INPAGE I have tried the following declarations when defining the fonts with no success: data, fdata, and fcode. Data and Fdata both return the same ERROR 115, but when I move it to fcode get compiler ERROR C156. I believe that this means that the value cannot be addressed directly (the failure occurs on this line "gcurvp->pfont = &SYSFONT;" where SYSFONT is stored in fcode). So my immediate question: Is there a way to allow a variable to be larger than 256 bytes and be stored in data/fdata only using compiler/linker settings? |
Hi Adam, There is no such 256-byte limitation in the compiler. All objects such as arrays must be INSECTION hence are inherently limited to a 64KB size. Ensure that your default RAM class is "data", not "zero page". Zero page is more efficient concerning code size, however it is limited to 256 bytes only! Please have a look at the AN55-Porting Cosmic applications to Raisonance.pdf in the installed documentation, which should be very helpful for your project.
Also, your tools are outdated and not supported anymore. Please download the latest version from Product Downloads. If this does not fix your problem, can you post a little sample code that shows the problem, so we can reproduce it in our Labs? Best Regards,
Sorry to post so quickly. I went and changed the the zeropage to data before trying sending this and it did not save for whatever reason. I didn't think to double check on this setting.
Resolution: Changed global variables from zero page to data and pressed "OK" (I believe this is the part that got messed up last time :) ).
Thanks again.
Bruno,
I have made the switch to the latest and greatest compiler / linker. As I feared, it broke my build and the issue at hand is centralized on the startup asm files.
The previous compiler (2009) had a single startup file that chose the reset vectors conditionally if it was either ST7 or STM8 and the new compiler determines outside of the asm file which startup file to link in (_ST7 or _STM8). I was hoping that my start up files from the previous compiler would work but they do not. They build fine and the MAP file appears to be similar to what MAP files from other projects built with the 2009 compiler, however when I burn the images to the target it will not run.
As a brief background I have had to modify the startup.asm for the 2009 compiler to move the reset vectors from 8000h to B000h to compensate for a custom bootloader. I switch at compile time on which asm to use (bootloadable or non-bootloadable). See below for my bootload startup file.
After switching to the 2011 compiler, I first located the only startup assembly files that I could find in the Ride directory : "C:\Program Files (x86)\Raisonance\Ride\inc\Sources\ST7-STM8\startup" and copied startup_STM8.asm to my project directory. The troubling is that when I add this file to the project (without modification) it breaks my build in the same fashion that the old startup file did.
I am not set on keeping the startup files in the project, I would really prefer a way to just move the reset vector inside of main and get rid of the ASM files all together. In addition, I am not able to update the bootloader at this point in time due the significant number of units deployed.
Any advice here would be appreciated.
Hi Adam,
For me your startup.asm is fine.
If you stick to the usual way RCSTM8 handles the startup, this is the baseline:
1) The linker will require a startup entry point if (and only if) there is a main() function in your application.
2) The RCSTM8 library provides pre-built, automatic startup files, that are automatically linked in your application if you do not provide your own startup.
3) If you provide the entry points CST7_START, CST7_START_V, CST7_START_Z, CST7_START_V_Z (as external references) in your application, then the linker will recognize it as being a startup file. Consequently it will not add any specific startup functionality from the C library.
You can keep your file as is, you could not get much better.
However, as you suggest, you could place the reset vector right inside your code. You just need to rename your main() function (let's rename it to appmain). Given my explanations 1-3 above, the linker will not put any startup in your application anymore.
To better describe how you can use that, here is the code for a C file that will setup the absolute minimal STM8 application. There is just a reset vector, that points to appmain(), which loops forever. As this application does NOT contain any main() function, the linker will not add any startup code.
The application has a code size of 6 bytes: 4 for the reset vector, 2 for the loop instruction.
You can use similar tricks to get away from the assembler code in your application, but a little bit of assembly code does not sound like a problem to me.
Note that the startup source code has been split between ST7 and STM8 versions in the last RKit-STM8 releases, as most customers use only one of these families, and we wanted to offer simpler startup code. That's it for the story.
Best Regards,
Bruno,
I have been trying to get this compiler to work for me with little to no luck regarding the start up files. Below I have a break down of each code startup configuration and any note I have on them.
I have spent quite some time trying to figure this out and have hit a pretty large brick wall. My working assumption is that the the globals / variables are not getting initialized or getting it's getting hung trying to clear the RAM. If you need more information please let me know and as always, thanks for all of your support.
Previous startup.asm as provided by Ride 7 in 2009
No ASM / Precompiled startup (WORKING)
startup_STM8 from /Ride/inc/Sources/ST7-STM8/startup (NOT WORKING)
startup.asm as defined in Ride 7 in 2009 (NOT WORKING)