Hello Rustys,
I am newbie to this langauge and am facing an issue with regards to the generated map file for a tricore tc375 embedded hardware. I am using hightec-llvm-rustc for compilation and linking, the issue here is, I have written a dummy function. This function is being compiled as static library and I am using it in C as an extern to read the return value. So far it works alongside C, but what I am interested is in compiling the rust function as a standalone for the tricore hardware i.e., I need a .map file and an .elf file, although both files are generating, when I inspect the .map file I dont see any section for my rust code. Below are few of my code snippets.
lib.rs
#![no_std]
#![feature(used_with_arg)]
use core::panic::PanicInfo;
#[no_mangle]
#[link_section = ".text.rust_comp"]
#[inline(never)]
#[allow(unused)]
#[allow(dead_code)]
pub extern "C" fn func_in_Rust(a: i32) -> i32
{
a * 3 + 7
}
#[used(linker)]
static FORCE_INCLUDE: extern "C" fn(i32) -> i32 = func_in_Rust;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {} // infinite loop to halt execution on panic
}
Cargo.toml
[package]
name = "rust_code"
version = "0.1.0"
edition = "2021"
[lib]
name = "rust_code"
crate-type = ["staticlib"]
path = "src/lib.rs"
[[bin]]
name = "firmware"
path = "src/main.rs"
any inputs is greatly appreciated.
Thanks