I have a few questions about the assembler 'area' command. Basically I should be able to do the following:
area bss(ram) -- for the RAM variables
area text(rom, rel) -- for the code
and then let the PSoC development environment manage the rest, correct? Or is there some advantage to having different areas?
I'd stick with this until you get to the point where you have multiple loadable configurations of analog and digital blocks. Then you can get fancy and use the
abs to force data or code to a fixed address or the
ovr option to share RAM across mutually exclusive data groups.
How do I control the size of the stack? Is there a default stack size?
Control of the size of the stack depends on careful design of your application. There is no hardware support for limiting the stack size, nor is there a default stack size.
I assume the stack starts at 0x00 and grows up. Should I 'org' the bss to do this? Since they share the same RAM space.
The stack starts at _stack_start, which is managed by the loader. The boot.asm code generated by PD sets up SP for you prior to calling _main, which is assumed to be the entry point for your code. The stack does grow upward and can overwrite the SSC control block before wrapping around to zero.
Do I want to let the assembler do "code compression", or is it automatic? Do I need to use .literal/.endliteral to protect data tables?
Actually code compression is done on the fully resolved binary the loader produces - duplicate sequences in the 'text' area are assumed to be repeated instruction sequences and are compressed by making a subroutine of the sequence and calling it. Read-only data tables, as well as string literals, need to be flagged as 'non-code' via the .literal/.endliteral directives to avoid being compressed. I'd suggest using the .literal/.endliteral directives but not turning code compression on - it is more trouble than it is worth to me.
Why would I want to use .section/.endsection? Is it similar to '#if 0 #endif' to conditionally compiled code?
These directives are used to bracket a code sequence that can be removed if the global label in the code sequence isn't referred to when the code is linked. The intended use is to minimize library code being loaded when not used. The assembler has
if, else, and
endif directives for conditional assembly. Look at boot.asm for examples of how this is used.