shrey1992
In general, SDCC does not generate ELF,you should specify some compiler options;
there is a demo config:
{
"version": 1,
"beforeBuildTasks": [],
"afterBuildTasks": [
{
"name": "clean",
"command": "del \"${OutDir}\\*.asm\" \"${OutDir}\\*.rst\" \"${OutDir}\\*.sym\" \"${OutDir}\\*.cdb\""
},
{
"name": "fix sdcc elf",
"command": "\"${ExeDir}\\stm8-objcopy.exe\" --remove-section SSEG \"${OutDir}\\${targetName}.elf\" \"${OutDir}\\${targetName}.elf\""
}
],
"global": {
"device": "stm8",
"optimize-type": "size",
"use-non-free": false,
"out-debug-info": true,
"specific-options": [
"--model-medium"
]
},
"c/cpp-compiler": {
"language-c": "c99",
"misc-controls": [
"--out-fmt-elf"
]
},
"asm-compiler": {},
"linker": {
"$mainFileName": "main",
"$use": "elf"
}
}
Note: SDCC has a 64KB limit on ELF relocation addresses. It is best to build the peripheral library as lib and add this lib to your project. This will save a lot of address space by not generating debugging information for the library