-
Notifications
You must be signed in to change notification settings - Fork 5.3k
bsp: cvitek: riscv: use marco for linker script #10202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| dtb/ | ||
| Image | ||
| Image | ||
|
|
||
| link.lds.generated |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright (c) 2006-2021, RT-Thread Development Team | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| #ifndef MEMORY_LAYOUT_H__ | ||
| #define MEMORY_LAYOUT_H__ | ||
|
|
||
| #include "../rtconfig.h" | ||
|
|
||
| /* Real start address of kernel is located after bootloader */ | ||
| #define KERNEL_OFFSET 0x200000 | ||
|
|
||
| #ifdef RT_USING_SMART | ||
| #define KERNEL_START (KERNEL_VADDR_START + KERNEL_OFFSET) | ||
| #define KERNEL_SIZE 64 * 1024 * 1024 | ||
| #else | ||
| #define KERNEL_START (0x80000000 + KERNEL_OFFSET) | ||
| #define KERNEL_SIZE 32 * 1024 * 1024 | ||
| #endif | ||
|
|
||
| #endif // MEMORY_LAYOUT_H__ | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| import os | ||||||
| import rtconfig | ||||||
| import platform | ||||||
| import subprocess | ||||||
|
|
||||||
| def generate_ldscript(input, output): | ||||||
|
|
||||||
| if not os.path.exists(input): | ||||||
| print('Error: file', input, 'not found') | ||||||
| return | ||||||
|
|
||||||
| if os.path.exists(output): | ||||||
| os.remove(output) | ||||||
|
|
||||||
| if rtconfig.PLATFORM == 'gcc': | ||||||
|
|
||||||
| gcc_cmd = os.path.join(rtconfig.EXEC_PATH, rtconfig.CC) | ||||||
|
|
||||||
| # gcc -E -P -x c $input -o $output | ||||||
| if (platform.system() == 'Windows'): | ||||||
| child = subprocess.Popen([gcc_cmd, '-E', '-P', '-x', 'c', input, '-o', output], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | ||||||
| else: | ||||||
| child = subprocess.Popen(gcc_cmd + f' -E -P -x c {input} -o {output}', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | ||||||
|
|
||||||
|
Comment on lines
+23
to
+24
|
||||||
| child = subprocess.Popen(gcc_cmd + f' -E -P -x c {input} -o {output}', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | |
| child = subprocess.Popen([gcc_cmd, '-E', '-P', '-x', 'c', input, '-o', output], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
尝试不成功,linux 上无法预处理生成,保持原写法。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块
#include "rtconfig.h"就可以了吧There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不行哎,我发现不加 “../”, 在 “bsp/cvitek/cv18xx_risc-v/gen_ld.py" 中会找不到 ”rtconfig.h“,导致无法生成 link.lds.generated。