#include <pthread.h>
I use this line code in Arm Development Studio built-in sve_array_subtract example and has build errors that "pthread.h" file not found. How to solve it, I wanna use both multi-thread and sve instrinsics in the project.
Thks, I met another mistake. I changed a simple Hello-World project, the target CPU choose armv9.2, and the FVP is AEMvAx1, and set semihosting-enable = 0 in model parameter, and when using memcpy to copy a struct to another destination struct, the value is incorrect, the code is
typedef struct { int width; int height; } init_param; typedef struct { init_param param; int flag; } test_handle; int main(int argc, char *argv[]) { uint8_t *a_buf = (uint8_t *)malloc(300000); printf("a_buf:%p\n", a_buf); printf("argc:%d\n", argc); for(int i=0; i<argc; i++) { printf("[%d] is %s\n", i, argv[i]); } init_param param22; param22.width = 3000; param22.height = 4000; test_handle *pHandle = (test_handle *)calloc(1, sizeof(test_handle)); printf("sizeof(test_handle) = %zu\n", sizeof(test_handle)); printf("offsetof(param):%zu\n", offsetof(test_handle, param)); printf("offsetof(flag):%zu\n", offsetof(test_handle, flag)); printf("pHandle:%p\n", pHandle); printf("param:%p\n", &pHandle->param); printf("flag:%p\n", &pHandle->flag); printf("sizeof(init_param):%zu\n", sizeof(init_param)); printf("param22:%p\n", ¶m22); printf("width:%p\n", ¶m22.width); test_handle pHandle1; pHandle1.param=param22; pHandle->param=param22; memcpy(&pHandle->param, ¶m22, sizeof(init_param)); cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! return 0; }
The struct offset and address seems right, offset of flag in test_handle is 8, equals to the sizeof init_param. And the project links scatter file(semihosting-enable=0 needs a scatter file to ensure heap malloc is ok) writes
; my_400mb_heap.sct ; 加载区域(通常放在 Flash,但代码也可放 RAM) LR_CODE 0x80000000 0x10000000 ; 256MB 用于代码和数据(可调整) { ; 可执行代码和只读数据 ER_RO 0x80000000 { *(+RO) } ; 可读写数据(全局变量、堆栈前的数据) RW_IRAM +0 { *(+RW +ZI) } ; 关键:定义 400MB 的 HEAP 区域 ARM_LIB_HEAP +0 EMPTY 0x19000000 {} ; 0x19000000 = 400MB (400 * 1024 * 1024) ; 栈(假设 1MB,向下增长) ARM_LIB_STACK 0xA0000000 EMPTY -0x100000 {} ; 栈顶放在 2.5GB 处(0x80000000 + 0x20000000) }
Is there something wrong in the project setting?