|
From: <ba...@us...> - 2006-09-18 00:01:23
|
Revision: 364
http://svn.sourceforge.net/cadcdev/?rev=364&view=rev
Author: bardtx
Date: 2006-09-17 17:01:19 -0700 (Sun, 17 Sep 2006)
Log Message:
-----------
dcload: Fix bfd support for binutils-2.15, and add external clock support.
https://sourceforge.net/mailarchive/forum.php?thread_id=30345196&forum_id=2046
Modified Paths:
--------------
dcload/dcload-serial/host-src/tool/dc-tool.c
dcload/dcload-serial/target-src/dcload/scif.c
Modified: dcload/dcload-serial/host-src/tool/dc-tool.c
===================================================================
--- dcload/dcload-serial/host-src/tool/dc-tool.c 2006-09-17 23:57:35 UTC (rev 363)
+++ dcload/dcload-serial/host-src/tool/dc-tool.c 2006-09-18 00:01:19 UTC (rev 364)
@@ -604,6 +604,9 @@
* N=13 (alternate, -3.1% error) for 115200
*/
+/* use_extclk controls whether the DC's serial port will use an external clock */
+int use_extclk = 0;
+
int change_speed(char *device_name, unsigned int speed)
{
unsigned char c;
@@ -614,6 +617,8 @@
blread(&c, 1);
if (speedhack && (speed == 115200))
send_uint(111600); /* get dcload to pick N=13 rather than N=12 */
+ else if (use_extclk)
+ send_uint(0);
else
send_uint(speed);
printf("Changing speed to %d bps... ", speed);
@@ -660,6 +665,7 @@
printf("-t <device> Use <device> to communicate with dc (default: %s)\n", SERIALDEVICE);
printf("-b <baudrate> Use <baudrate> (default: %d)\n", BAUD_RATE);
printf("-e Try alternate 115200 (must also use -b 115200)\n");
+ printf("-E Use an external clock for the DC's serial port\n");
printf("-n Do not attach console and fileserver\n");
printf("-p Use dumb terminal rather than console/fileserver\n");
printf("-q Do not clear screen before download\n");
@@ -699,20 +705,20 @@
if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) {
printf("Section %s, ",section->name);
printf("lma 0x%x, ",section->lma);
- printf("size %d\n",section->size);
- if (section->size) {
- size += section->size;
- inbuf = malloc(section->size);
- bfd_get_section_contents(somebfd, section, inbuf, 0, section->size);
+ printf("size %d\n",section->_raw_size);
+ if (section->_raw_size) {
+ size += section->_raw_size;
+ inbuf = malloc(section->_raw_size);
+ bfd_get_section_contents(somebfd, section, inbuf, 0, section->_raw_size);
c = 'B';
serial_write(&c, 1);
blread(&c, 1);
send_uint(section->lma);
- send_uint(section->size);
+ send_uint(section->_raw_size);
- send_data(inbuf, section->size, 1);
+ send_data(inbuf, section->_raw_size, 1);
free(inbuf);
}
@@ -970,7 +976,7 @@
if (argc < 2)
usage();
- someopt = getopt(argc, argv, "x:u:d:a:s:t:b:c:i:npqheg");
+ someopt = getopt(argc, argv, "x:u:d:a:s:t:b:c:i:npqheEg");
while (someopt > 0) {
switch (someopt) {
case 'x':
@@ -1038,6 +1044,9 @@
case 'e':
speedhack = 1;
break;
+ case 'E':
+ use_extclk = 1;
+ break;
case 'g':
printf("Starting a GDB server on port 2159\n");
open_gdb_socket(2159);
Modified: dcload/dcload-serial/target-src/dcload/scif.c
===================================================================
--- dcload/dcload-serial/target-src/dcload/scif.c 2006-09-17 23:57:35 UTC (rev 363)
+++ dcload/dcload-serial/target-src/dcload/scif.c 2006-09-18 00:01:19 UTC (rev 364)
@@ -35,23 +35,27 @@
void scif_init(int bps)
{
+ /* Modified to allow external baudrate (bps == 0) */
+
int i;
-
- *SCSCR2 = 0x0; /* clear TE and RE bits in SCSCR2 */
+
+ *SCSCR2 = bps ? 0x0 : 0x02; /* clear TE and RE bits / if (bps == 0) CKE1 on (bit 1) */
*SCFCR2 = 0x6; /* set TFRST and RFRST bits in SCFCR2 */
*SCSMR2 = 0x0; /* set data transfer format 8n1 */
- *SCBRR2 = (50 * 1000000) / (32 * bps) - 1; /* set bit rate */
+
+ if (bps) *SCBRR2 = (50 * 1000000) / (32 * bps) - 1; /* if (bps != 0) set baudrate */
+
for (i = 0; i < 100000; i++); /* delay at least 1 bit interval */
-
+
*SCFCR2 = 12;
*SCFCR2 = 0x8; /* set MCE in SCFCR2 */
*SCSPTR2 = 0;
*SCFSR2 = 0x60;
*SCLSR2 = 0;
- *SCSCR2 = 0x30; /* set TE and RE bits in SCSCR2 */
-
- for (i = 0; i < 100000; i++);
+ *SCSCR2 = bps ? 0x30 : 0x32; /* set TE and RE bits / if (bps == 0) CKE1 on (bit 1) */
+
+ for (i = 0; i < 100000; i++);
}
unsigned char scif_getchar(void)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|