-
Notifications
You must be signed in to change notification settings - Fork 49
Frequently Asked Questions
-
Q: How to change heap and stack size in baremetal applications?
A: To change size of heap in baremetal applications the following option should be specified to the linker:
--defsym=__DEFAULT_HEAP_SIZE=${SIZE}, where${SIZE}is desired heap size, in bytes. It also possible to use size suffixes, likekandmto specify size in kilobytes and megabytes respectively. For stack size respective option is--defsym=__DEFAULT_STACK_SIZE=${STACK_SIZE}. Note that those are linker commands - they are valid only when passed to "ld" application, if gcc driver is used for linking, then those options should be prefixed with-Wl. For example:$ arc-elf32-gcc -Wl,--defsym=__DEFAULT_HEAP_SIZE=256m -Wl,--defsym=__DEFAULT_STACK_SIZE=1024m hello.o -o hello.binThose options are valid only when default linker script is used. If custom linker script is used, then effective way to change stack/heap size depends on properties of that linker script - it might be the same, or it might be different.
-
Q: There are can't resolve symbol error messages when using gdbserver on Linux for ARC target
A: This error message might appear when gdbserver is a statically linked application. Even though it is linked statically, gdbserver still opens
libthread_db.solibrary usingdlopen()function. There is a circular dependency here, aslibthread_db.soexpects several dynamic symbols to be already defined in the loading application (gdbserver in this case). However statically linked gdbserver doesn't export those dynamic symbols, thereforedlopen()invocation causes those error messages. In practice there haven't been noticed any downside of this, even when debugging applications with threads, however that was tried only with simple test cases. To fix this issue, either rebuild gdbserver as a dynamically linked application, or pass option--with-libthread-db=-lthread_dbtoconfigurescript of script. In this case gdbserver will link withlibthread_dbstatically, instead of opening it withdlopen()and dependency on symbols will be resolved at link time.