Change symbol extraction to use objdump not nm

nm outputs warnings to stderr so hard to clean output.

Also now picks up global variables, like NMIIrqOn.
This commit is contained in:
Angus Gratton 2015-06-02 17:57:33 +10:00
parent 9e3328abe8
commit 81afe58334
3 changed files with 10 additions and 7 deletions

View file

@ -139,7 +139,7 @@ void PendSV(enum SVC_ReqType);
ESPTODO: It may be possible to just read the 'ps' register instead ESPTODO: It may be possible to just read the 'ps' register instead
of accessing thisvariable. of accessing thisvariable.
*/ */
extern char NMIIrqIsOn; extern char sdk_NMIIrqIsOn;
extern char level1_int_disabled; extern char level1_int_disabled;
extern unsigned cpu_sr; extern unsigned cpu_sr;
@ -150,7 +150,7 @@ extern unsigned cpu_sr;
*/ */
inline static __attribute__((always_inline)) void _esp_disable_interrupts(void) inline static __attribute__((always_inline)) void _esp_disable_interrupts(void)
{ {
if(!NMIIrqIsOn && !level1_int_disabled) { if(!sdk_NMIIrqIsOn && !level1_int_disabled) {
__asm__ volatile ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) : "=a" (cpu_sr) :: "memory"); __asm__ volatile ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) : "=a" (cpu_sr) :: "memory");
level1_int_disabled = 1; level1_int_disabled = 1;
} }
@ -158,7 +158,7 @@ inline static __attribute__((always_inline)) void _esp_disable_interrupts(void)
inline static __attribute__((always_inline)) void _esp_enable_interrupts(void) inline static __attribute__((always_inline)) void _esp_enable_interrupts(void)
{ {
if(!NMIIrqIsOn && level1_int_disabled) { if(!sdk_NMIIrqIsOn && level1_int_disabled) {
level1_int_disabled = 0; level1_int_disabled = 0;
__asm__ volatile ("wsr %0, ps" :: "a" (cpu_sr) : "memory"); __asm__ volatile ("wsr %0, ps" :: "a" (cpu_sr) : "memory");
} }

View file

@ -47,6 +47,7 @@ NM = $(CROSS)nm
CPP = $(CROSS)g++ CPP = $(CROSS)g++
SIZE = $(CROSS)size SIZE = $(CROSS)size
OBJCOPY = $(CROSS)objcopy OBJCOPY = $(CROSS)objcopy
OBJDUMP = $(CROSS)objdump
# Source components to compile and link. Each of these are subdirectories # Source components to compile and link. Each of these are subdirectories
# of the root, with a 'component.mk' file. # of the root, with a 'component.mk' file.
@ -184,10 +185,12 @@ $(BUILD_DIR)sdklib/%.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/allsymbols.rename
$(BUILD_DIR)sdklib/norename.match: $(ROOT)lib/symbols_norename.txt | $(BUILD_DIR)sdklib $(BUILD_DIR)sdklib/norename.match: $(ROOT)lib/symbols_norename.txt | $(BUILD_DIR)sdklib
grep -v "^#" $< | sed ':begin;$!N;s/\n/\\|/;tbegin' > $@ grep -v "^#" $< | sed ':begin;$!N;s/\n/\\|/;tbegin' > $@
# Generate list of symbols to rename from a single library. Uses grep & sed. # Generate list of defined symbols to rename from a single library. Uses grep & sed.
$(BUILD_DIR)sdklib/%.rename: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/norename.match $(BUILD_DIR)sdklib/%.rename: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/norename.match
$(vecho) "Building symbol list for $< -> $@" $(vecho) "Building symbol list for $< -> $@"
$(Q) $(NM) --defined $< | grep ' T ' | sed -r 's/(.+) T (.+)/\2 sdk_\2/' | grep -v `cat $(BUILD_DIR)sdklib/norename.match` > $@ $(Q) $(OBJDUMP) -t $< | grep ' g ' \
| sed -r 's/^.+ ([^ ]+)$$/\1 sdk_\1/' \
| grep -v `cat $(BUILD_DIR)sdklib/norename.match` > $@
# Build master list of all SDK-defined symbols to rename # Build master list of all SDK-defined symbols to rename
$(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS)) $(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS))

View file

@ -36,8 +36,8 @@ static xQueueHandle mainqueue;
void user_init(void) void user_init(void)
{ {
uart_div_modify(0, UART_CLK_FREQ / 115200); sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
printf("SDK version:%s\n", system_get_sdk_version()); printf("SDK version:%s\n", sdk_system_get_sdk_version());
mainqueue = xQueueCreate(10, sizeof(uint32_t)); mainqueue = xQueueCreate(10, sizeof(uint32_t));
xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL); xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL);
xTaskCreate(task2, (signed char *)"tsk2", 256, &mainqueue, 2, NULL); xTaskCreate(task2, (signed char *)"tsk2", 256, &mainqueue, 2, NULL);