Skip to content

Commit 917bbb1

Browse files
committed
[fw-isoldr] Added support for extended memory on NAOMI.
Also bump version to 0.8.4
1 parent c342c47 commit 917bbb1

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

firmware/isoldr/loader/Makefile.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
TARGET = 0x8ce00000
88
BUILD = build
9-
VERSION = "0.8.3"
9+
VERSION = "0.8.4"
1010
INSTALL_PATH = ../../../build/firmware/isoldr
1111
# INSTALL_PATH = /Volumes/DREAMSHELL/DS/firmware/isoldr
1212

firmware/isoldr/loader/cdda.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
/* AICA memory end for PCM buffer */
3838
#define AICA_MEMORY_START 0x00800000
3939
#define AICA_MEMORY_END 0x00a00000
40+
#define AICA_MEMORY_8MB_END 0x01000000
4041
#define AICA_MEMORY_END_ARM 0x00200000
42+
#define AICA_MEMORY_8MB_END_ARM 0x00800000
4143

4244
#define aica_dma_in_progress() AICA_DMA_ADST
4345
#define aica_dma_disable() AICA_DMA_ADEN = 0
@@ -302,10 +304,12 @@ static void setup_pcm_buffer(void) {
302304
}
303305

304306
/* Setup buffer at end of sound memory */
305-
cdda->aica_left[0] = AICA_MEMORY_END - cdda->size;
307+
const uint32 aica_memory_end = malloc_heap_pos() > RAM_END_ADDR ?
308+
AICA_MEMORY_8MB_END : AICA_MEMORY_END;
309+
cdda->aica_left[0] = aica_memory_end - cdda->size;
306310
cdda->aica_left[1] = cdda->aica_left[0] + (cdda->size >> 2);
307311

308-
cdda->aica_right[0] = AICA_MEMORY_END - (cdda->size >> 1);
312+
cdda->aica_right[0] = aica_memory_end - (cdda->size >> 1);
309313
cdda->aica_right[1] = cdda->aica_right[0] + (cdda->size >> 2);
310314

311315
/* Setup end position for sound buffer */
@@ -386,7 +390,9 @@ static void aica_stop_clean_cdda() {
386390
static void aica_setup_cdda(int clean) {
387391

388392
uint32 val;
389-
const uint32 smp_ptr = AICA_MEMORY_END_ARM - cdda->size;
393+
const uint32 aica_memory_end = malloc_heap_pos() > RAM_END_ADDR ?
394+
AICA_MEMORY_8MB_END_ARM : AICA_MEMORY_END_ARM;
395+
const uint32 smp_ptr = aica_memory_end - cdda->size;
390396
const int smp_size = cdda->size >> 1;
391397

392398
/* Stop AICA channels */

firmware/isoldr/loader/include/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define FLASH_ROM_ICON_ADDR (FLASH_ROM_ADDR + 0x1a480)
3434
#define RAM_START_ADDR 0x0c000000
3535
#define RAM_END_ADDR 0x0d000000
36+
#define RAM_END_32MB_ADDR 0x0e000000
3637

3738
/* Software environment structure in RAM */
3839
#define SYSCALLS_INFO_ADDR (RAM_START_ADDR)

firmware/isoldr/loader/malloc.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,19 @@ static void internal_malloc_stat(uint32 *free_size, uint32 *max_free_size) {
192192

193193
uint32 exec_addr = CACHED_ADDR(APP_BIN_ADDR);
194194

195-
if ((uint32)internal_malloc_base < exec_addr) {
195+
if((uint32)internal_malloc_base > CACHED_ADDR(RAM_END_ADDR)) {
196+
*free_size = CACHED_ADDR(RAM_END_32MB_ADDR) - (uint32)internal_malloc_base;
197+
}
198+
else if ((uint32)internal_malloc_base < exec_addr) {
196199
if(IsoInfo->exec.type == BIN_TYPE_KATANA) {
197200
*free_size = CACHED_ADDR(IP_BIN_BOOTSTRAP_2_ADDR) - (uint32)internal_malloc_pos;
198-
} else {
201+
}
202+
else {
199203
*free_size = exec_addr - (uint32)internal_malloc_pos;
200204
}
201-
} else {
202-
*max_free_size = CACHED_ADDR(RAM_END_ADDR) - (uint32)internal_malloc_base;
205+
}
206+
else {
207+
*free_size = CACHED_ADDR(RAM_END_ADDR) - (uint32)internal_malloc_base;
203208
}
204209
*max_free_size = *free_size;
205210
}

0 commit comments

Comments
 (0)