Hello, and welcome to the forum.
The project map file will detail the use of RAM for global and static variables only, that are assigned to a specific address. For C programming in particular, the total stack usage will not be known, and is difficult to estimate. It could be a significant portion of the total RAM available.
For the QG4, with only 256 bytes of RAM, make sure that the global variables commence at the lowest RAM address (within zero page), and that the stack pointer is initialised to top of RAM. This will keep the stack and the globals as far separated as possible, to lessen the chance of the stack usage over-writing the variables. This may require optimisation of the PRM file, and the use of #pragmas within the code. It is possible for the stack size allocated within the PRM file to be exceeded during operation of the code.
During testing and debug of your code, it is a good idea to check for the amout of stack used at various times. Initialise all RAM available to the stack to a known value (perhaps 0x00 or 0xFF). Then periodically enter a break point so that the contents of RAM can be examined. The lowest address that does not contain the pre-determined value will indicate the current extent of the stack.
You can use a QG4 on the demo board. Another possibility is to leave the QG8 device in situ, and simply assign the QG4 device to your project. The QG8 will be directly compatible with any code written for the QG4, but not vice versa.
Regards,
Mac